16 #ifndef INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCRESPONSE_H_ 17 #define INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCRESPONSE_H_ 22 #include "nn/nlib/Swap.h" 26 #ifdef __cpp_rvalue_references 30 #if defined(_MSC_VER) && defined(nx_msgpack_EXPORTS) 31 #undef NLIB_VIS_PUBLIC 32 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 45 kInvalidRequest = -32600,
46 kMethodNotFound = -32601,
47 kInvalidParams = -32602,
48 kInternalError = -32603,
54 error_msg_(
nullptr) {}
58 #ifdef __cpp_rvalue_references 64 this->SetError(errcode, msg, data);
85 friend class JsonRpcResponseReader;
86 friend class JsonRpcRequest;
105 #ifdef __cpp_rvalue_references 108 is_msgpack_(rhs.is_msgpack_) {
113 is_msgpack_ = rhs.is_msgpack_;
120 is_msgpack_(rhs.is_msgpack_) {
125 is_msgpack_ = rhs.is_msgpack_;
130 is_msgpack_(msgpack) {}
134 #ifdef __cpp_rvalue_references 135 std::tuple<errno_t, UniquePtrType, size_t> EndWriteResponse()
NLIB_NOEXCEPT;
139 struct JsonRpcResponseWriterPrivate;
140 JsonRpcResponseWriterPrivate* prv_;
148 NLIB_DEFINE_STD_SWAP(::nlib_ns::msgpack::jsonrpc::JsonRpcResponseWriter)
149 #if defined(_MSC_VER) && defined(nx_msgpack_EXPORTS) 150 #undef NLIB_VIS_PUBLIC 151 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 154 #endif // INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCRESPONSE_H_ JsonRpcResponseWriter(JsonRpcResponseWriter &&rhs) noexcept
Instantiates the object (move constructor).
UniquePtr< JsonRpcResponse > ValueType
Stores the JSON-RPC response via UniquePtr.
void SetError(int errcode, const char *msg) noexcept
Sets the JSON-RPC function error.
Class for representing the JSON-RPC response.
#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) noexcept
Creates a msgpack byte string when true is specified as the argument.
In the C++11 environment (which supports alias templates), std::unique_ptr is made an alias template...
Defines that class that is corresponding to std::unique_ptr.
Class that reads the JSON-RPC response byte string.
JsonRpcResponseWriter & operator=(JsonRpcResponseWriter &&rhs) noexcept
Move assignment operator.
Object created when MessagePack or JSON is read.
MpObject & GetMpObject() noexcept
Returns the JSON-RPC return value, or additional information about an error.
Defines the class that resembles std::vector but can store objects that cannot be copied...
const MpObject & GetMpObject() const noexcept
The const decoration version of the above function.
An empty structure indicating that an argument to a function needs to be moved.
const char * GetErrorMessage() const noexcept
Returns an error message.
Object created when MessagePack, JSON, or CSV is read.
reqid_t GetId() const noexcept
Returns the ID of the JSON-RPC response.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
ErrorCode
Definition of the predefined error code contained in the JSON-RPC response.
#define NLIB_CEXPR
Defines constexpr if it is available for use. If not, holds an empty string.
A file that contains the configuration information for each development environment.
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.
ErrorCode GetError() const noexcept
Returns an error code.
Nlist< ValueType > ListType
Type that stores the JSON-RPC response sequence.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
JsonRpcResponse() noexcept
Instantiates the object with default parameters (default constructor).
constexpr JsonRpcResponseWriter() noexcept
Instantiates the object with default parameters (default constructor).