KCalendarCore

exceptions.h
Go to the documentation of this file.
1 /*
2  This file is part of the kcalcore library.
3 
4  SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 /**
9  @file
10  This file is part of the API for handling calendar data and
11  defines the Exception class.
12 
13  We don't use actual C++ exceptions right now. These classes are currently
14  returned by an error function; but we can build upon them, if/when we start
15  to use C++ exceptions.
16 
17  @brief
18  Exception base class.
19 
20  @author Cornelius Schumacher <[email protected]>
21 */
22 
23 #ifndef KCALCORE_EXCEPTIONS_H
24 #define KCALCORE_EXCEPTIONS_H
25 
26 #include "kcalendarcore_export.h"
27 
28 #include <QString>
29 #include <QStringList>
30 
31 #include <memory>
32 
33 namespace KCalendarCore
34 {
35 class ExceptionPrivate;
36 
37 /**
38  Exception base class, currently used as a fancy kind of error code
39  and not as an C++ exception.
40 */
41 class KCALENDARCORE_EXPORT Exception
42 {
43 public:
44  /**
45  The different types of error codes
46  */
47  enum ErrorCode {
48  LoadError, /**< Load error */
49  SaveError, /**< Save error */
50  ParseErrorIcal, /**< Parse error in libical */
51  ParseErrorKcal, /**< Parse error in libkcal */
52  NoCalendar, /**< No calendar component found */
53  CalVersion1, /**< vCalendar v1.0 detected */
54  CalVersion2, /**< iCalendar v2.0 detected */
55  CalVersionUnknown, /**< Unknown calendar format detected */
56  Restriction, /**< Restriction violation */
57  UserCancel, /**< User canceled the operation */
58  NoWritableFound, /**< No writable resource is available */
59  SaveErrorOpenFile,
60  SaveErrorSaveFile,
61  LibICalError,
62  VersionPropertyMissing,
63  ExpectedCalVersion2,
64  ExpectedCalVersion2Unknown,
65  ParseErrorNotIncidence,
66  ParseErrorEmptyMessage,
67  ParseErrorUnableToParse,
68  ParseErrorMethodProperty,
69  };
70 
71  /**
72  Construct an exception.
73  @param code is the error code.
74  @param arguments is a list of arguments that can be passed
75  to an i18n engine to help build a descriptive message for the user, a common
76  argument is for example the filename where the error occurred.
77  */
78  explicit Exception(const ErrorCode code, const QStringList &arguments = QStringList());
79 
80  /**
81  Destructor.
82  */
83  virtual ~Exception();
84 
85  /**
86  Returns the error code.
87  @return The ErrorCode for this exception.
88  */
89  Q_REQUIRED_RESULT virtual ErrorCode code() const;
90 
91  /**
92  Returns the arguments.
93  @return A QStringList with the argument list for this exception.
94  */
95  Q_REQUIRED_RESULT virtual QStringList arguments() const;
96 
97 private:
98  std::unique_ptr<ExceptionPrivate> d;
99 };
100 
101 } // namespace
102 
103 #endif
@ NoWritableFound
No writable resource is available.
Definition: exceptions.h:58
Namespace for all KCalendarCore types.
Definition: alarm.h:36
Exception base class, currently used as a fancy kind of error code and not as an C++ exception.
Definition: exceptions.h:41
@ CalVersion2
iCalendar v2.0 detected
Definition: exceptions.h:54
@ LoadError
Load error.
Definition: exceptions.h:48
@ SaveError
Save error.
Definition: exceptions.h:49
@ UserCancel
User canceled the operation.
Definition: exceptions.h:57
@ Restriction
Restriction violation.
Definition: exceptions.h:56
ErrorCode
The different types of error codes.
Definition: exceptions.h:47
@ ParseErrorKcal
Parse error in libkcal.
Definition: exceptions.h:51
@ CalVersionUnknown
Unknown calendar format detected.
Definition: exceptions.h:55
@ CalVersion1
vCalendar v1.0 detected
Definition: exceptions.h:53
@ ParseErrorIcal
Parse error in libical.
Definition: exceptions.h:50
@ NoCalendar
No calendar component found.
Definition: exceptions.h:52
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:00:45 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.