29 #include <type_traits>
40 :
type(ok ? Ok : SystemError)
42 ,
desc(ok ?
"No error." :
"System call returned error."){
68 operator bool()
const {
84 static inline const char* strerr_r(
int eno,
char* buf,
size_t sz){
86 strerror_s(buf, sz, eno);
89 auto r = strerror_r(eno, buf, sz);
91 if(std::is_same<decltype(r),
int>::value){
int sys_errno
The associated errno for the error, or 0 if not a system error.
Definition: nrg_status.h:62
Status(const char *custom)
Constructor for custom errors, with the specified error string.
Definition: nrg_status.h:47
Derived class for system errors.
Definition: nrg_status.h:79
enum nrg::Status::@0 type
Enumeration for error type.
Derived class for non-error statuses.
Definition: nrg_status.h:74
Class to wrap system and internal errors.
Definition: nrg_status.h:34
Status(bool ok, int err=0)
Constructor with the given error-status and errno for system-errors.
Definition: nrg_status.h:39
const char * desc
Statically-allocated description of the error.
Definition: nrg_status.h:65
Status()
Default Constructor, creates a no-error status.
Definition: nrg_status.h:36