You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.0 KiB
C++
55 lines
1.0 KiB
C++
/******************************************************************************
|
|
* 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 <string>
|
|
|
|
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_
|