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 };
133
140 static Error syserr();
141
147 static Error syserr(int errnum);
148
149#if defined(PROMEKI_PLATFORM_WINDOWS)
155 static Error syserr(DWORD winErr);
156#endif
157
168 static Error syserr(const std::error_code &ec);
169
174 Error(Code code = Ok) : _code(code) {}
175
177 ~Error() {}
178
180 bool operator==(const Error &other) const { return _code == other._code; }
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; }
191
196 Code code() const { return _code; }
197
202 bool isOk() const { return _code == 0; }
203
208 bool isError() const { return _code != 0; }
209
214 const String &name() const;
215
220 const String &desc() const;
221
226 const String &systemErrorName() const;
227
232 int systemError() const;
233
234 private:
235 Code _code;
236};
237
238PROMEKI_NAMESPACE_END
239
240#endif // PROMEKI_ENABLE_CORE