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
ムーブコンストラクタです。
UniquePtr< JsonRpcResponse > ValueType
UniquePtr経由でJSON-RPCのレスポンスを格納します。
void SetError(int errcode, const char *msg) noexcept
JSON-RPC関数のエラーを設定します。
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
TypeName で指定されたクラスのコピーコンストラクタと代入演算子を禁止します。
#define NLIB_SAFE_BOOL(class_name, exp)
クラス内に安全なoperator bool()を定義します。 可能であればC++11のexplicit boolを利用します。 ...
JsonRpcResponseWriter(bool msgpack) noexcept
引数にtrueを指定するとmsgpackのバイト列を作成します。
C++11環境(エイリアステンプレートが可能な環境)においてはstd::unique_ptrにエイリアステンプレートされま...
std::unique_ptrに相当するクラスが定義されています。
JSON-RPCのレスポンスのバイト列を読み込むためのクラスです。
JsonRpcResponseWriter & operator=(JsonRpcResponseWriter &&rhs) noexcept
ムーブ代入演算子です。
MessagePack又はJSONを読み込むことで作成されるオブジェクトです。
MpObject & GetMpObject() noexcept
JSON-RPCの戻り値か、エラーの付加情報を返します。
std::vectorに似ていますが、コピーできないオブジェクトを格納可能なクラスが定義されています。 ...
const MpObject & GetMpObject() const noexcept
上記関数のconst修飾付き版です。
空の構造体で、関数の引数をムーブすべきことを示すために利用されます。
const char * GetErrorMessage() const noexcept
エラーメッセージを返します。
MessagePack, JSON及びCSVを読み込むと作成されるオブジェクトです。
reqid_t GetId() const noexcept
JSON-RPCレスポンスのid を返します。
#define NLIB_NOEXCEPT
環境に合わせてnoexcept 又は同等の定義がされます。
ErrorCode
JSON-RPCのレスポンスに含まれる(事前定義の)エラーコードの定義です。
#define NLIB_CEXPR
利用可能であればconstexprが定義されます。そうでない場合は空文字列です。
uint32_t reqid_t
JSON-RPCのリクエストに付与されるidの型です。
std::vectorに似た、コピーコンストラクタを持たないオブジェクトを格納可能なコンテナ類似クラスです。 ...
JSON-RPCのレスポンスのバイト列を書きこむためのクラスです。
ErrorCode GetError() const noexcept
エラーコードを返します。
Nlist< ValueType > ListType
JSON-RPCのレスポンスのシーケンスを格納する型です。
#define NLIB_FINAL
利用可能であればfinalが定義されます。そうでない場合は空文字列です。
JsonRpcResponse() noexcept
デフォルトコンストラクタです。
constexpr JsonRpcResponseWriter() noexcept
デフォルトコンストラクタです。