34 #include "trm/ResponseStatus.h"
54 const Enum<ResponseStatus> ResponseStatus::kOk (Ok,
"Ok");
55 const Enum<ResponseStatus> ResponseStatus::kGeneralError (GeneralError,
"GeneralError");
56 const Enum<ResponseStatus> ResponseStatus::kMalFormedRequest (MalFormedRequest,
"MalFormedRequest");
57 const Enum<ResponseStatus> ResponseStatus::kUnRecognizedRequest (UnRecognizedRequest,
"UnRecognizedRequest");
59 const Enum<ResponseStatus> ResponseStatus::kInvalidToken (MAKE_PAIR(InvalidToken));
60 const Enum<ResponseStatus> ResponseStatus::kInvalidState (MAKE_PAIR(InvalidState));
61 const Enum<ResponseStatus> ResponseStatus::kUserCancellation (MAKE_PAIR(UserCancellation));
62 const Enum<ResponseStatus> ResponseStatus::kInsufficientResource(MAKE_PAIR(InsufficientResource));
64 const std::vector<const Enum<ResponseStatus> * > & ResponseStatus::getEnums(
void)
66 static std::vector<const Enum<ResponseStatus> * > enums_;
67 if (enums_.size() == 0) {
68 enums_.push_back(&ResponseStatus::kOk);
69 enums_.push_back(&ResponseStatus::kGeneralError);
70 enums_.push_back(&ResponseStatus::kMalFormedRequest);
71 enums_.push_back(&ResponseStatus::kUnRecognizedRequest);
72 enums_.push_back(&ResponseStatus::kInvalidToken);
73 enums_.push_back(&ResponseStatus::kInvalidState);
74 enums_.push_back(&ResponseStatus::kUserCancellation);
75 enums_.push_back(&ResponseStatus::kInsufficientResource);
77 Assert(enums_.size() == MAX_ENUM_NUMBER);
83 ResponseStatus::ResponseStatus(
const Enum<ResponseStatus> &statusCode,
const std::string &details)
84 : statusCode(statusCode), details(details)
88 ResponseStatus::ResponseStatus(
const char *name,
const std::string &details)
89 : statusCode(Enum<ResponseStatus>::at(name)), details(details)
93 ResponseStatus::~ResponseStatus(
void)
97 const Enum<ResponseStatus> & ResponseStatus::getStatusCode(
void)
const
103 bool ResponseStatus::operator == (
const ResponseStatus &that)
const
105 return (this->statusCode == that.statusCode);
108 ResponseStatus & ResponseStatus::operator += (
const char *message)
113 ResponseStatus & ResponseStatus::operator= (
const Enum<ResponseStatus> &status)
119 void ResponseStatus::print(
void)
const
122 std::cout <<
"[OBJ][" << klassName() <<
"][details]" << details << std::endl;
125 const std::string & ResponseStatus::getDetails(
void)
const
130 std::string & ResponseStatus::getDetails(
void)