1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-09-28 00:33:31 +02:00
doorlockd-mirror/doorlockd/response.cpp
2015-09-25 00:50:09 +02:00

23 lines
432 B
C++

#include <json/json.h>
#include "response.h"
const std::string Response::_codeKey = "code";
const std::string Response::_messageKey = "message";
Response::operator bool() const
{
return code == Response::Code::Success;
}
std::string Response::toJson() const
{
Json::Value response;
Json::StyledWriter writer;
response[_codeKey] = code;
response[_messageKey] = message;
return writer.write(response);
}