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.
43 lines
849 B
C++
43 lines
849 B
C++
/******************************************************************************
|
|
* File - OpRes.cpp
|
|
* 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.
|
|
*
|
|
******************************************************************************/
|
|
|
|
#include "OpRes.h"
|
|
|
|
namespace lunarium
|
|
{
|
|
bool OpRes::operator==(const OpRes& rhs)
|
|
{
|
|
return this->Type == rhs.Type;
|
|
}
|
|
|
|
bool OpRes::operator==(ResultType rhs)
|
|
{
|
|
return this->Type == rhs;
|
|
}
|
|
|
|
OpRes OpRes::OK()
|
|
{
|
|
return { ResultType::OK, "The operation succeeded" };
|
|
}
|
|
|
|
OpRes OpRes::Fail(const char* why)
|
|
{
|
|
return { ResultType::FAIL, why };
|
|
}
|
|
|
|
bool IsOK(OpRes&& res)
|
|
{
|
|
return res.Type == ResultType::OK;
|
|
}
|
|
|
|
bool Failed(OpRes&& res)
|
|
{
|
|
return res.Type == ResultType::FAIL;
|
|
}
|
|
} |