17#include <fletcher/fletcher.h>
27 fstatus_t
val = FLETCHER_STATUS_ERROR;
36 [[nodiscard]]
bool ok()
const {
return val == FLETCHER_STATUS_OK; }
39 void ewf(
const std::string &msg =
"")
const {
42 std::cerr << msg << std::endl;
44 std::cerr <<
message << std::endl;
60 return Status(FLETCHER_STATUS_ERROR, std::move(msg));
64#define STATUS_FACTORY(RAW_ID, MESSAGE) \
65 static Status RAW_ID() { \
66 return Status(FLETCHER_STATUS_##RAW_ID, MESSAGE); \
Contains all Fletcher classes and functions for use in run-time applications.
#define STATUS_FACTORY(RAW_ID, MESSAGE)
Status return value of all Fletcher run-time functions.
Status(const fstatus_t val=FLETCHER_STATUS_ERROR)
fstatus_t val
The raw status value.
bool operator==(const Status &rhs) const
Compare raw status values for equality.
static Status ERROR(std::string msg="")
Return an ERROR status with some message.
bool ok() const
Return true if the status is OK.
void ewf(const std::string &msg="") const
Exit the program on a failure status, with some message. If no message is supplied,...
static Status OK()
Return an OK status.
std::string message
Optional message.
Status(const fstatus_t val, std::string msg)
Construct a new status.