QtJsonSerializer  4.0.0
A library to perform generic seralization and deserialization of QObjects
exception.h
1 #ifndef QTJSONSERIALIZER_EXCEPTION_H
2 #define QTJSONSERIALIZER_EXCEPTION_H
3 
4 #include "QtJsonSerializer/qtjsonserializer_global.h"
5 #include <QtCore/qstring.h>
6 #include <QtCore/qsharedpointer.h>
7 #include <QtCore/qstack.h>
8 
9 #if !defined(QT_NO_EXCEPTIONS) && QT_CONFIG(future)
10 #include <QtCore/qexception.h>
11 namespace QtJsonSerializer {
14 }
15 #else
16 #include <exception>
17 namespace QtJsonSerializer {
19 using ExceptionBase = std::exception;
20 }
21 #endif
22 
23 namespace QtJsonSerializer {
24 
25 class ExceptionPrivate;
27 class Q_JSONSERIALIZER_EXPORT Exception : public ExceptionBase
28 {
29 public:
32 
34  Exception(const QByteArray &what);
35 
37  const char *what() const noexcept final;
38 
40  QByteArray message() const;
42  PropertyTrace propertyTrace() const;
43 
45  virtual void raise() const;
47  virtual ExceptionBase *clone() const;
48 
49 protected:
51  QSharedPointer<ExceptionPrivate> d;
52 };
53 
55 class Q_JSONSERIALIZER_EXPORT SerializationException : public Exception
56 {
57 public:
60 
61  void raise() const override;
62  ExceptionBase *clone() const override;
63 };
64 
66 class Q_JSONSERIALIZER_EXPORT DeserializationException : public Exception
67 {
68 public:
71 
72  void raise() const override;
73  ExceptionBase *clone() const override;
74 };
75 
76 }
77 
78 #endif // QTJSONSERIALIZER_EXCEPTION_H
QtJsonSerializer
The QtJsonSerializer namespace holds all classes of the module.
Definition: cborserializer.h:7
QtJsonSerializer::ExceptionBase
QException ExceptionBase
The exception base class to use for this module.
Definition: exception.h:13
QSharedPointer
QStack
QtJsonSerializer::SerializationException
Exception thrown by the serializers if something goes wrong while serializing.
Definition: exception.h:55
QException
QtJsonSerializer::Exception
Exception thrown by QJsonSerializer if something goes wrong.
Definition: exception.h:27
QByteArray
QtJsonSerializer::DeserializationException
Exception thrown by the serializers if something goes wrong while deserializing.
Definition: exception.h:66