PxCrypt v0.1
Encrypt data within an image
Loading...
Searching...
No Matches
decode_error.h
1#ifndef DECODE_ERROR_H
2#define DECODE_ERROR_H
3
4// Shared Library Support
5#include "pxcrypt/pxcrypt_codec_export.h"
6
7// Qx Includes
8#include <qx/core/qx-abstracterror.h>
9
10namespace PxCrypt
11{
12
13class PXCRYPT_CODEC_EXPORT QX_ERROR_TYPE(DecodeError, "PxCrypt::DecoderError", 6878)
14{
15 friend class Decoder;
16//-Class Enums------------------------------------------------------------------------------------------------
17public:
18 enum Type
19 {
20 NoError = 0,
21 InvalidSource = 1,
22 MissingMedium = 2,
23 DimensionMismatch = 3,
24 NotLargeEnough = 4,
25 InvalidMeta = 5,
26 InvalidHeader = 6,
27 LengthMismatch = 7,
28 UnexpectedEnd = 8,
29 ChecksumMismatch = 9
30 };
31
32//-Class Variables------------------------------------------------------------------------------------------------
33private:
34 static inline const QString PRIMARY_STRING = u"Decoding failed."_s;
35
36//-Instance Variables------------------------------------------------------------------------------------------------
37private:
38 Type mType;
39 QString mString;
40
41//-Constructor----------------------------------------------------------------------------------------------------------
42public:
44
45private:
46 DecodeError(Type type, QString errStr);
47
48//-Instance Functions---------------------------------------------------------------------------------------------------
49private:
50 quint32 deriveValue() const override;
51 QString derivePrimary() const override;
52 QString deriveSecondary() const override;
53
54 template<typename... Args>
55 DecodeError arged(Args... args) const
56 {
57 DecodeError a = *this;
58 a.mString = a.mString.arg(&args...);
59 }
60
61public:
62 bool isValid() const;
63 Type type() const;
64 QString errorString() const;
65};
66
67}
68
69#endif // DECODE_ERROR_H
The DecodeError class is used to report errors during image decoding.
Definition decode_error.h:14
Type
Definition decode_error.h:19
The Decoder class provides the means to skim and decrypt data from the color channels of an encoded i...
Definition decoder.h:17
The PxCrypt namespace is the main namespace through which all functionality of the PxCrypt library is...
Definition decode_error.cpp:5
QString arg(Args &&... args) const const