PxCrypt v0.2.2
Encrypt data within an image
Loading...
Searching...
No Matches
artwork_error.h
1#ifndef ARTWORK_ERROR_H
2#define ARTWORK_ERROR_H
3
4// Qt Includes
5#include <QString>
6#include <QHash>
7
8using namespace Qt::Literals::StringLiterals;
9
10namespace PxCryptPrivate
11{
12
13class ArtworkError
14{
15//-Class Enums-------------------------------------------------------------
16public:
17 enum Type
18 {
19 NoError,
20 NotMagic,
21 WrongCodec,
22 DataStreamError,
23 IntegrityError
24 };
25
26//-Class Variables-------------------------------------------------------------
27private:
28 static inline const QHash<Type, QString> ERR_STRINGS{
29 {NoError, u""_s},
30 {NotMagic, u"Image is not a magic image (missing magic number)."_s},
31 {WrongCodec, u"Image created with a different codec than specified (mismatched rendition)."_s},
32 {DataStreamError, u"An error occurred while streaming data from/to the canvas."_s},
33 {IntegrityError, u"A data integrity check failed while reading data."_s}
34 };
35
36//-Instance Variables-------------------------------------------------------------
37private:
38 Type mType;
39 QString mDetails;
40
41//-Constructor-------------------------------------------------------------
42public:
43 ArtworkError(Type t = NoError, const QString& d = {});
44
45//-Instance Functions-------------------------------------------------------------
46public:
47 bool isValid() const;
48 Type type() const;
49 QString details() const;
50
51//-Operators-------------------------------------------------------------
52public:
53 operator bool() const { return isValid(); }
54};
55
56}
57
58#endif // ARTWORK_ERROR_H