16 #ifndef INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCREQUEST_H_ 17 #define INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCREQUEST_H_ 24 #include "nn/nlib/Swap.h" 29 #if defined(_MSC_VER) && defined(nx_msgpack_EXPORTS) 30 #undef NLIB_VIS_PUBLIC 31 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 39 class JsonRpcErrorRequestTest;
77 friend class fortest::JsonRpcErrorRequestTest;
87 : prv_(NULL), is_msgpack_(use_msgpack) {}
92 return WriteRequest(method,
id, nil_param);
95 return WriteRequest(method, 0, params);
99 return WriteRequest(method, 0, nil_param);
102 return WriteRequest(req.GetMethod(), req.GetId(), req.GetParams());
107 swap(prv_, rhs.prv_);
108 swap(is_msgpack_, rhs.is_msgpack_);
112 struct JsonRpcRequestWriterPrivate;
113 JsonRpcRequestWriterPrivate* prv_;
131 NLIB_DEFINE_STD_SWAP(::nlib_ns::msgpack::jsonrpc::JsonRpcRequestWriter)
132 #if defined(_MSC_VER) && defined(nx_msgpack_EXPORTS) 133 #undef NLIB_VIS_PUBLIC 134 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 137 #endif // INCLUDE_NN_NLIB_MSGPACK_JSONRPC_JSONRPCREQUEST_H_
errno_t WriteRequest(const char *method, reqid_t id) noexcept
Writes a JSON-RPC request that specifies no parameters.
JsonRpcRequestWriter() noexcept
Instantiates the object with default parameters (default constructor).
Class for representing the JSON-RPC response.
JsonRpcRequest() noexcept
Instantiates the object with default parameters (default constructor).
errno_t WriteNotification(const char *method, const MpObject ¶ms) noexcept
Writes the JSON-RPC notification.
const char * GetMethod() const noexcept
Gets the method name of the request.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
void SetId(reqid_t id) noexcept
Sets the request ID.
Class to serialize and write the JSON-RPC request to memory.
reqid_t GetId() const noexcept
Get the id of the request. If 0, the request is a notification.
UniquePtr owns the pointer, and when it goes out of scope, the pointer is released by the destructor ...
Defines that class that is corresponding to std::unique_ptr.
Object created when MessagePack or JSON is read.
JsonRpcRequestWriter(bool use_msgpack) noexcept
Sets the use of msgpack instead of JSON as the JSON description method.
Defines the class that resembles std::vector but can store objects that cannot be copied...
void swap(MpObject &rhs) noexcept
Swaps the content of the object.
Class that reads the JSON-RPC request.
Class for representing a JSON-RPC request.
void MoveParamsFrom(MpObject ¶ms) noexcept
Sets the JSON-RPC parameters.
Object created when MessagePack, JSON, or CSV is read.
errno_t WriteNotification(const char *method) noexcept
Writes a JSON-RPC Notification that specifies no parameters.
Nlist< JsonRpcRequest > ListType
Type used to store the JSON-RPC request sequence restored from the byte string.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
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...
const MpObject & GetParams() const noexcept
Gets the parameter of the request.
errno_t WriteRequest(const JsonRpcRequest &req) noexcept
Writes the JSON-RPC request.
size_t JsonRpcServerExec(const void *p, size_t n, ReallocOutputStream::UniquePtrType *ptr)
Creates the JSON-RPC response byte string by processing the JSON-RPC request.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
MpObject & GetParams() noexcept
Gets the parameter of the request.