/****************************************************************************** * File - OpRes.h * Author - Joey Pollack * Date - 2020/03/05 (y/m/d) * Mod Date - 2020/03/05 (y/m/d) * Description - Operation Result. Also contains a message describing the result. * ******************************************************************************/ #ifndef _OPERATION_RESULT_H_ #define _OPERATION_RESULT_H_ #ifdef BUFFER_SIZE #undef BUFFER_SIZE #endif #include namespace lunarium { enum ResultType { OK, WARNING, // Not used yet FAIL }; struct OpRes { ResultType Type; std::string Description; bool operator==(const OpRes& rhs); bool operator==(ResultType rhs); static OpRes OK(); static OpRes Fail(const char* why, ...); OpRes LogIfFailed(int category, const char* prepend_msg = nullptr); private: static const int BUFFER_SIZE = 512; static char Buffer[OpRes::BUFFER_SIZE]; }; bool IsOK(OpRes&& res); bool IsOK(OpRes& res); bool Failed(OpRes&& res); bool Failed(OpRes& res); } #endif // _OPERATION_RESULT_H_