libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
error.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_CORE
13#include <system_error>
14#include <promeki/namespace.h>
15#include <promeki/platform.h>
16
17PROMEKI_NAMESPACE_BEGIN
18
19class String;
20
46class Error {
47 public:
57 enum Code {
58 Ok = 0,
59 UnsupportedSystemError,
60 LibraryFailure,
61 SingularMatrix,
62 NotImplemented,
63 PixelFormatNotSupported,
64 OutOfRange,
65 PermissionDenied,
66 TryAgain,
67 BadFileDesc,
68 Busy,
69 Exists,
70 BadAddress,
71 TooLarge,
72 Interrupt,
73 Invalid,
74 IOError,
75 IsDir,
76 TooManyOpenFiles,
77 TooManyOpenSysFiles,
78 NotExist,
79 NoMem,
80 NoSpace,
81 NotDir,
82 NoPermission,
83 ReadOnly,
84 IllegalSeek,
85 Timeout,
86 CrossDeviceLink,
87 NoFrameRate,
88 AlreadyOpen,
89 NotSupported,
90 OpenFailed,
91 NotOpen,
92 EndOfFile,
93 InvalidArgument,
94 InvalidDimension,
95 NotHostAccessible,
96 BufferTooSmall,
97 IdNotFound,
98 ConversionFailed,
99 Stopped,
100 Cancelled,
101 DecodeFailed,
102 EncodeFailed,
103 CorruptData,
104 DeviceError,
105 DeviceNotFound,
106 FormatMismatch,
107 FontUnavailable,
108 BrokenPipe,
109 ConnectionReset,
110 ConnectionRefused,
111 HostNotFound,
112 ParseFailed,
113 ClockDomainMismatch,
114 ObjectGone,
115 ClockPaused,
116 DurationUnknown,
117 FrameRangeInfinite,
118 NotAdjacent,
119 PipelineBuildFailed,
120 PipelineRuntimeError,
121 InspectorDiscontinuityDetected,
122 Empty,
123 NotFound,
124 BuildIdentMismatch,
125 NotReady,
126 AuthenticationRequired,
127 ProtocolError,
128 SignalLoss,
129 ProtectedAncCode,
130 InsufficientContext,
131 InvalidChecksum,
132 TransactionAborted,
133 TruncatedData
134 };
135
142 static Error syserr();
143
149 static Error syserr(int errnum);
150
151#if defined(PROMEKI_PLATFORM_WINDOWS)
157 static Error syserr(DWORD winErr);
158#endif
159
170 static Error syserr(const std::error_code &ec);
171
176 Error(Code code = Ok) : _code(code) {}
177
179 ~Error() {}
180
182 bool operator==(const Error &other) const { return _code == other._code; }
184 bool operator!=(const Error &other) const { return _code != other._code; }
186 bool operator<(const Error &other) const { return _code < other._code; }
188 bool operator<=(const Error &other) const { return _code <= other._code; }
190 bool operator>(const Error &other) const { return _code > other._code; }
192 bool operator>=(const Error &other) const { return _code >= other._code; }
193
198 Code code() const { return _code; }
199
204 bool isOk() const { return _code == 0; }
205
210 bool isError() const { return _code != 0; }
211
216 const String &name() const;
217
222 const String &desc() const;
223
228 const String &systemErrorName() const;
229
234 int systemError() const;
235
236 private:
237 Code _code;
238};
239
240PROMEKI_NAMESPACE_END
241
242#endif // PROMEKI_ENABLE_CORE