PxCrypt v0.1
Encrypt data within an image
Loading...
Searching...
No Matches
encode_error.h
1#ifndef ENCODE_ERROR_H
2#define ENCODE_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(EncodeError, "PxCrypt::EncoderError", 6978)
14{
15 friend class Encoder;
16//-Class Enums------------------------------------------------------------------------------------------------
17public:
18 enum Type
19 {
20 NoError = 0,
21 MissingPayload = 1,
22 InvalidImage = 2,
23 WontFit = 3,
24 InvalidBpc = 4
25 };
26
27//-Class Variables------------------------------------------------------------------------------------------------
28private:
29 static inline const QString PRIMARY_STRING = u"Encoding failed."_s;
30
31//-Instance Variables------------------------------------------------------------------------------------------------
32private:
33 Type mType;
34 QString mString;
35
36//-Constructor----------------------------------------------------------------------------------------------------------
37public:
39
40private:
41 EncodeError(Type type, QString errStr);
42
43//-Instance Functions---------------------------------------------------------------------------------------------------
44private:
45 quint32 deriveValue() const override;
46 QString derivePrimary() const override;
47 QString deriveSecondary() const override;
48
49 template<typename... Args>
50 EncodeError arged(Args... args) const
51 {
52 EncodeError a = *this;
53 a.mString = a.mString.arg(args...);
54 return a;
55 }
56
57public:
58 bool isValid() const;
59 Type type() const;
60 QString errorString() const;
61};
62
63
64}
65
66#endif // ENCODE_ERROR_H
The EncodeError class is used to report errors during image encoding.
Definition encode_error.h:14
Type
Definition encode_error.h:19
The Encoder class provides serialization of binary data to portions of an arbitrary image's color cha...
Definition encoder.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