1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-12-22 18:34:25 +01:00
doorlockd-mirror/doorlockd/response.cpp

23 lines
432 B
C++
Raw Normal View History

2015-09-22 21:22:48 +02:00
#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);
}