3 #ifndef INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCRESPONSE_H_
4 #define INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCRESPONSE_H_
7 #include "nn/nlib/Swap.h"
14 #if defined(_MSC_VER) && defined(nx_msgpack_EXPORTS)
15 #undef NLIB_VIS_PUBLIC
16 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT
29 INVALID_REQUEST = -32600,
30 METHOD_NOT_FOUND = -32601,
31 INVALID_PARAMS = -32602,
32 INTERNAL_ERROR = -32603,
41 this->SetError(errcode, msg, data);
44 bool IsError()
const {
return m_IsError; }
46 reqid_t
GetId()
const {
return m_Id; }
48 const char* msg = m_ErrorMsg.get();
49 return msg ? msg :
"";
57 void SetId(reqid_t
id) { m_Id = id; }
68 friend class JsonRpcResponseReader;
69 friend class JsonRpcRequest;
77 static errno_t ReadResponse(
const void* p,
size_t n, ListType* result_list);
81 ListType* result_list);
83 ListType* result_list);
111 #if defined(_MSC_VER) && defined(nx_msgpack_EXPORTS)
112 #undef NLIB_VIS_PUBLIC
113 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT
116 #endif // INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCRESPONSE_H_
UniquePtr< JsonRpcResponse > ValueType
Stores the JSON-RPC response via UniquePtr.
Class for representing the JSON-RPC response.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
#define NLIB_SAFE_BOOL(class_name, exp)
Defines a safe operator bool function in the class. Uses the C++11 explicit bool if it is available f...
JsonRpcResponseWriter(bool msgpack)
Creates a msgpack byte string when true is specified as the argument.
The class for output streams written to memory expanded using nlib_realloc or another realloc functio...
bool IsError() const
Returns whether an error has occurred.
Defines that class that is corresponding to std::unique_ptr.
void SetError(int errcode, const char *msg)
Sets the JSON-RPC function error.
Class that reads the JSON-RPC response byte string.
int GetErrorCode() const
Returns an error code.
Object created when MessagePack or JSON is read.
Defines the class that resembles std::vector but can store objects that cannot be copied...
reqid_t GetId() const
Returns the ID of the JSON-RPC response.
const MpObject & GetMpObject() const
Returns the JSON-RPC return value, or additional information about an error.
Object created when MessagePack, JSON, or CSV is read.
ErrorCode
Definition of the predefined error code contained in the JSON-RPC response.
A file that contains the configuration information for each development environment.
JsonRpcResponse()
Instantiates the object with default parameters (default constructor).
uint32_t reqid_t
id type for the JSON-RPC request.
A container-like class similar to std::vector that can store objects that do not have copy constructo...
Class that writes the JSON-RPC response byte string.
JsonRpcResponseWriter()
Instantiates the object with default parameters (default constructor).
Nlist< ValueType > ListType
Type that stores the JSON-RPC response sequence.
Quickly accesses MessagePack expanded in memory.
const char * GetErrorMessage() const
Returns an error message.
MpObject & GetMpObject()
Returns the JSON-RPC return value, or additional information about an error.
Defines the class for reading MessagePack at high speed.