Electroneum
cryptonote::rpc::Message Class Reference

#include <message.h>

Collaboration diagram for cryptonote::rpc::Message:

Public Member Functions

 Message ()
 
virtual ~Message ()
 
virtual rapidjson::Value toJson (rapidjson::Document &doc) const
 
virtual void fromJson (rapidjson::Value &val)
 

Public Attributes

std::string status
 
std::string error_details
 
uint32_t rpc_version
 

Static Public Attributes

static const char * STATUS_OK = "OK"
 
static const char * STATUS_RETRY = "Retry"
 
static const char * STATUS_FAILED = "Failed"
 
static const char * STATUS_BAD_REQUEST = "Invalid request type"
 
static const char * STATUS_BAD_JSON = "Malformed json"
 

Detailed Description

Definition at line 59 of file message.h.

Constructor & Destructor Documentation

◆ Message()

cryptonote::rpc::Message::Message ( )
inline

Definition at line 68 of file message.h.

68 : status(STATUS_OK), rpc_version(0) { }
std::string status
Definition: message.h:76
static const char * STATUS_OK
Definition: message.h:62

◆ ~Message()

virtual cryptonote::rpc::Message::~Message ( )
inlinevirtual

Definition at line 70 of file message.h.

70 { }

Member Function Documentation

◆ fromJson()

void cryptonote::rpc::Message::fromJson ( rapidjson::Value val)
virtual

Definition at line 70 of file message.cpp.

71 {
75 }
std::string error_details
Definition: message.h:77
std::string status
Definition: message.h:76
#define GET_FROM_JSON_OBJECT(source, dst, key)
Definition: json_object.h:52

◆ toJson()

rapidjson::Value cryptonote::rpc::Message::toJson ( rapidjson::Document doc) const
virtual

Definition at line 57 of file message.cpp.

58 {
60 
61  auto& al = doc.GetAllocator();
62 
63  val.AddMember("status", rapidjson::StringRef(status.c_str()), al);
64  val.AddMember("error_details", rapidjson::StringRef(error_details.c_str()), al);
65  INSERT_INTO_JSON_OBJECT(val, doc, rpc_version, DAEMON_RPC_VERSION_ZMQ);
66 
67  return val;
68 }
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
Definition: json_object.h:47
std::string error_details
Definition: message.h:77
std::string status
Definition: message.h:76
object
Definition: rapidjson.h:624
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: document.h:2116
GenericStringRef< CharType > StringRef(const CharType *str)
Mark a character pointer as constant string.
Definition: document.h:361
Here is the call graph for this function:

Member Data Documentation

◆ error_details

std::string cryptonote::rpc::Message::error_details

Definition at line 77 of file message.h.

◆ rpc_version

uint32_t cryptonote::rpc::Message::rpc_version

Definition at line 78 of file message.h.

◆ status

std::string cryptonote::rpc::Message::status

Definition at line 76 of file message.h.

◆ STATUS_BAD_JSON

const char * cryptonote::rpc::Message::STATUS_BAD_JSON = "Malformed json"
static

Definition at line 66 of file message.h.

◆ STATUS_BAD_REQUEST

const char * cryptonote::rpc::Message::STATUS_BAD_REQUEST = "Invalid request type"
static

Definition at line 65 of file message.h.

◆ STATUS_FAILED

const char * cryptonote::rpc::Message::STATUS_FAILED = "Failed"
static

Definition at line 64 of file message.h.

◆ STATUS_OK

const char * cryptonote::rpc::Message::STATUS_OK = "OK"
static

Definition at line 62 of file message.h.

◆ STATUS_RETRY

const char * cryptonote::rpc::Message::STATUS_RETRY = "Retry"
static

Definition at line 63 of file message.h.


The documentation for this class was generated from the following files: