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 <schumacher@kde.org>
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 <schumacher@kde.org>
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
33namespace KCalendarCore
34{
35class ExceptionPrivate;
36
37/**
38 Exception base class, currently used as a fancy kind of error code
39 and not as an C++ exception.
40*/
41class KCALENDARCORE_EXPORT Exception
42{
43public:
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
97private:
98 std::unique_ptr<ExceptionPrivate> d;
99};
100
101} // namespace
102
103#endif
Exception base class, currently used as a fancy kind of error code and not as an C++ exception.
Definition exceptions.h:42
ErrorCode
The different types of error codes.
Definition exceptions.h:47
@ ParseErrorIcal
Parse error in libical.
Definition exceptions.h:50
@ NoCalendar
No calendar component found.
Definition exceptions.h:52
@ CalVersion2
iCalendar v2.0 detected
Definition exceptions.h:54
@ 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
@ NoWritableFound
No writable resource is available.
Definition exceptions.h:58
@ UserCancel
User canceled the operation.
Definition exceptions.h:57
@ Restriction
Restriction violation.
Definition exceptions.h:56
Namespace for all KCalendarCore types.
Definition alarm.h:37
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:47 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.