21#include <rtl/ustring.hxx>
44#define ERRCODE_ERROR_MASK 0x3fffffffUL
45#define ERRCODE_WARNING_MASK 0x80000000UL
47#define ERRCODE_CLASS_SHIFT 8
48#define ERRCODE_AREA_SHIFT 13
49#define ERRCODE_DYNAMIC_SHIFT 26
51#define ERRCODE_CLASS_MASK (31UL << ERRCODE_CLASS_SHIFT)
53#define ERRCODE_DYNAMIC_COUNT 31UL
54#define ERRCODE_DYNAMIC_MASK (31UL << ERRCODE_DYNAMIC_SHIFT)
67 assert(nCode <= 0xff &&
"code out of range");
72 assert(nCode <= 0xff &&
"code out of range");
76 explicit constexpr ErrCode(sal_uInt32 nValue)
81 explicit operator sal_uInt32()
const {
return m_value; }
82 explicit operator bool()
const {
return m_value != 0; }
107 return m_value && !IsWarning();
139 return "0x" + OUString::number(
m_value, 16);
145 template <
typename... Args>
bool anyOf(Args... args)
const
147 static_assert(
sizeof...(args) > 0);
148 return (... || (*
this ==
args));
197#define ERRCODE_NONE ErrCode(0)
199#define ERRCODE_IO_MISPLACEDCHAR ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 1 )
200#define ERRCODE_IO_NOTEXISTS ErrCode( ErrCodeArea::Io, ErrCodeClass::NotExists, 2 )
201#define ERRCODE_IO_ALREADYEXISTS ErrCode( ErrCodeArea::Io, ErrCodeClass::AlreadyExists, 3 )
202#define ERRCODE_IO_NOTADIRECTORY ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 4 )
203#define ERRCODE_IO_NOTAFILE ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 5 )
204#define ERRCODE_IO_INVALIDDEVICE ErrCode( ErrCodeArea::Io, ErrCodeClass::Path, 6 )
205#define ERRCODE_IO_ACCESSDENIED ErrCode( ErrCodeArea::Io, ErrCodeClass::Access, 7 )
206#define ERRCODE_IO_LOCKVIOLATION ErrCode( ErrCodeArea::Io, ErrCodeClass::Locking, 8 )
207#define ERRCODE_IO_OUTOFSPACE ErrCode( ErrCodeArea::Io, ErrCodeClass::Space, 9 )
208#define ERRCODE_IO_ISWILDCARD ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 11 )
209#define ERRCODE_IO_NOTSUPPORTED ErrCode( ErrCodeArea::Io, ErrCodeClass::NotSupported, 12 )
210#define ERRCODE_IO_GENERAL ErrCode( ErrCodeArea::Io, ErrCodeClass::General, 13 )
211#define ERRCODE_IO_TOOMANYOPENFILES ErrCode( ErrCodeArea::Io, ErrCodeClass::Space, 14 )
212#define ERRCODE_IO_CANTREAD ErrCode( ErrCodeArea::Io, ErrCodeClass::Read, 15 )
213#define ERRCODE_IO_CANTWRITE ErrCode( ErrCodeArea::Io, ErrCodeClass::Write, 16 )
214#define ERRCODE_IO_OUTOFMEMORY ErrCode( ErrCodeArea::Io, ErrCodeClass::Space, 17 )
215#define ERRCODE_IO_CANTSEEK ErrCode( ErrCodeArea::Io, ErrCodeClass::General, 18 )
216#define ERRCODE_IO_CANTTELL ErrCode( ErrCodeArea::Io, ErrCodeClass::General, 19 )
217#define ERRCODE_IO_WRONGVERSION ErrCode( ErrCodeArea::Io, ErrCodeClass::Version, 20 )
218#define ERRCODE_IO_WRONGFORMAT ErrCode( ErrCodeArea::Io, ErrCodeClass::Format, 21 )
219#define ERRCODE_IO_INVALIDCHAR ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 22 )
220#define ERRCODE_IO_UNKNOWN ErrCode( ErrCodeArea::Io, ErrCodeClass::Unknown, 23 )
221#define ERRCODE_IO_INVALIDACCESS ErrCode( ErrCodeArea::Io, ErrCodeClass::Access, 24 )
222#define ERRCODE_IO_CANTCREATE ErrCode( ErrCodeArea::Io, ErrCodeClass::Create, 25 )
223#define ERRCODE_IO_INVALIDPARAMETER ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 26 )
224#define ERRCODE_IO_ABORT ErrCode( ErrCodeArea::Io, ErrCodeClass::Abort, 27 )
225#define ERRCODE_IO_NOTEXISTSPATH ErrCode( ErrCodeArea::Io, ErrCodeClass::NotExists, 28 )
226#define ERRCODE_IO_PENDING ErrCode( ErrCodeArea::Io, ErrCodeClass::NotExists, 29 )
227#define ERRCODE_IO_RECURSIVE ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 30 )
228#define ERRCODE_IO_NAMETOOLONG ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 31 )
229#define ERRCODE_IO_INVALIDLENGTH ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 32 )
230#define ERRCODE_IO_CURRENTDIR ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 33 )
231#define ERRCODE_IO_NOTSAMEDEVICE ErrCode( ErrCodeArea::Io, ErrCodeClass::Parameter, 34 )
232#define ERRCODE_IO_DEVICENOTREADY ErrCode( ErrCodeArea::Io, ErrCodeClass::Read, 35 )
233#define ERRCODE_IO_BADCRC ErrCode( ErrCodeArea::Io, ErrCodeClass::Read, 36 )
234#define ERRCODE_IO_WRITEPROTECTED ErrCode( ErrCodeArea::Io, ErrCodeClass::Access, 37 )
235#define ERRCODE_IO_BROKENPACKAGE ErrCode( ErrCodeArea::Io, ErrCodeClass::Format, 38 )
236#define ERRCODE_IO_NOTSTORABLEINBINARYFORMAT ErrCode( ErrCodeArea::Io, ErrCodeClass::Format, 39 )
237#define ERRCODE_IO_FILTERDISABLED ErrCode( ErrCodeArea::Io, ErrCodeClass::Format, 40 )
241#define SVSTREAM_GENERALERROR ERRCODE_IO_GENERAL
242#define SVSTREAM_FILE_NOT_FOUND ERRCODE_IO_NOTEXISTS
243#define SVSTREAM_PATH_NOT_FOUND ERRCODE_IO_NOTEXISTSPATH
244#define SVSTREAM_TOO_MANY_OPEN_FILES ERRCODE_IO_TOOMANYOPENFILES
245#define SVSTREAM_ACCESS_DENIED ERRCODE_IO_ACCESSDENIED
246#define SVSTREAM_SHARING_VIOLATION ERRCODE_IO_LOCKVIOLATION
247#define SVSTREAM_LOCKING_VIOLATION ERRCODE_IO_LOCKVIOLATION
248#define SVSTREAM_SHARE_BUFF_EXCEEDED ERRCODE_IO_LOCKVIOLATION
250#define SVSTREAM_INVALID_ACCESS ERRCODE_IO_INVALIDACCESS
251#define SVSTREAM_INVALID_HANDLE ERRCODE_IO_GENERAL
252#define SVSTREAM_CANNOT_MAKE ERRCODE_IO_CANTCREATE
253#define SVSTREAM_INVALID_PARAMETER ERRCODE_IO_INVALIDPARAMETER
255#define SVSTREAM_READ_ERROR ERRCODE_IO_CANTREAD
256#define SVSTREAM_WRITE_ERROR ERRCODE_IO_CANTWRITE
257#define SVSTREAM_SEEK_ERROR ERRCODE_IO_CANTSEEK
259#define SVSTREAM_OUTOFMEMORY ERRCODE_IO_OUTOFMEMORY
261#define SVSTREAM_FILEFORMAT_ERROR ERRCODE_IO_WRONGFORMAT
262#define SVSTREAM_WRONGVERSION ERRCODE_IO_WRONGVERSION
264#define SVSTREAM_DISK_FULL ERRCODE_IO_OUTOFSPACE
266#define PRINTER_ABORT ERRCODE_IO_ABORT
267#define PRINTER_GENERALERROR ERRCODE_IO_GENERAL
269#define ERRCODE_ABORT ERRCODE_IO_ABORT
271#define ERRCODE_INET_NAME_RESOLVE ErrCode(ErrCodeArea::Inet, ErrCodeClass::Read, 1)
272#define ERRCODE_INET_CONNECT ErrCode(ErrCodeArea::Inet, ErrCodeClass::Read, 2)
273#define ERRCODE_INET_READ ErrCode(ErrCodeArea::Inet, ErrCodeClass::Read, 3)
274#define ERRCODE_INET_WRITE ErrCode(ErrCodeArea::Inet, ErrCodeClass::Write, 4)
275#define ERRCODE_INET_GENERAL ErrCode(ErrCodeArea::Inet, ErrCodeClass::Write, 5)
276#define ERRCODE_INET_OFFLINE ErrCode(ErrCodeArea::Inet, ErrCodeClass::Read, 6)
constexpr sal_uInt8 GetCode() const
bool operator<(ErrCode const &other) const
ErrCode StripDynamic() const
OUString toHexString() const
bool operator==(ErrCode const &other) const
constexpr ErrCode(ErrCodeArea nArea, sal_uInt16 nClassAndCode)
constexpr ErrCodeArea GetArea() const
constexpr ErrCodeClass GetClass() const
sal_uInt32 GetDynamic() const
constexpr ErrCode(WarningFlag, ErrCodeArea nArea, ErrCodeClass nClass, sal_uInt16 nCode)
bool operator<=(ErrCode const &other) const
constexpr ErrCode(sal_uInt32 nValue)
constexpr ErrCode(ErrCodeArea nArea, ErrCodeClass nClass, sal_uInt16 nCode)
ErrCode IgnoreWarning() const
convert to ERRCODE_NONE if it's a warning, else return the error
bool anyOf(Args... args) const
constexpr ErrCode StripWarningAndDynamic() const
bool operator>(ErrCode const &other) const
bool operator>=(ErrCode const &other) const
bool operator!=(ErrCode const &other) const
ErrCode MakeWarning() const
#define COMPHELPER_DLLPUBLIC
COMPHELPER_DLLPUBLIC std::ostream & operator<<(std::ostream &os, const ErrCode &err)
#define ERRCODE_AREA_SHIFT
#define ERRCODE_DYNAMIC_SHIFT
#define ERRCODE_DYNAMIC_MASK
#define ERRCODE_ERROR_MASK
#define ERRCODE_WARNING_MASK
#define ERRCODE_CLASS_SHIFT
OUString toString(OptionInfo const *info)