16 #ifndef INCLUDE_NN_NLIB_MSGPACK_MPWALKER_H_ 17 #define INCLUDE_NN_NLIB_MSGPACK_MPWALKER_H_ 21 #include "nn/nlib/Swap.h" 23 #ifdef __cpp_rvalue_references 27 #if defined(_MSC_VER) && defined(nx_msgpack_EXPORTS) 28 #undef NLIB_VIS_PUBLIC 29 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 40 : cur_(static_cast<const uint8_t*>(p)),
44 cur_ =
static_cast<const uint8_t*
>(p);
55 return operator[](static_cast<size_t>(array_idx));
81 #ifdef __cpp_rvalue_references 83 std::tuple<MpWalker, const nlib_utf8_t*, uint32_t> rval;
84 std::get<0>(rval) = GetString(&std::get<1>(rval), &std::get<2>(rval));
88 std::tuple<MpWalker, const nlib_byte_t*, uint32_t> rval;
90 GetBinary(reinterpret_cast<const void**>(&std::get<1>(rval)), &std::get<2>(rval));
94 std::tuple<MpWalker, int8_t, const nlib_byte_t*, uint32_t> rval;
95 std::get<0>(rval) = GetExt(&std::get<1>(rval),
96 reinterpret_cast<const void**
>(&std::get<2>(rval)),
102 std::pair<MpWalker, uint32_t> rval;
103 rval.first = GetMapCount(&rval.second);
107 std::pair<MpWalker, uint32_t> rval;
108 rval.first = GetArrayCount(&rval.second);
112 std::pair<MpWalker, bool> rval;
113 rval.first = GetBoolean(&rval.second);
117 std::pair<MpWalker, int32_t> rval;
118 rval.first = GetInt(&rval.second);
122 std::pair<MpWalker, int64_t> rval;
123 rval.first = GetInt(&rval.second);
127 std::pair<MpWalker, uint32_t> rval;
128 rval.first = GetUint(&rval.second);
132 std::pair<MpWalker, uint64_t> rval;
133 rval.first = GetUint(&rval.second);
137 std::pair<MpWalker, float> rval;
138 rval.first = GetFloat(&rval.second);
142 std::pair<MpWalker, double> rval;
143 rval.first = GetDouble(&rval.second);
147 std::pair<MpWalker, nlib_time> rval;
148 rval.first = GetTimestamp(&rval.second);
163 #if defined(_MSC_VER) && defined(nx_msgpack_EXPORTS) 164 #undef NLIB_VIS_PUBLIC 165 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 168 #endif // INCLUDE_NN_NLIB_MSGPACK_MPWALKER_H_ std::tuple< MpWalker, const nlib_byte_t *, uint32_t > GetBinary() const noexcept
文字列が格納されている場合、バイナリ(bin format)のデータを取得します。
#define NLIB_SAFE_BOOL(class_name, exp)
クラス内に安全なoperator bool()を定義します。 可能であればC++11のexplicit boolを利用します。 ...
std::pair< MpWalker, uint32_t > GetArrayCount() const noexcept
配列が格納されている場合、配列のサイズを取得します。
constexpr MpWalker() noexcept
デフォルトコンストラクタです。
size_t GetSize() const noexcept
MessagePackデータのサイズを取得します。
MpWalker operator[](int array_idx) const noexcept
インデックスを指定して配列の要素にアクセスします。
const nlib_byte_t * GetPtr() const noexcept
MessagePackデータの現在位置へのポインタを取得します。
std::pair< MpWalker, bool > GetBoolean() const noexcept
ブール値が格納されている場合、ブール値を取得します。戻り値のMpWalkerオブジェクトは、成功した場合次の...
std::pair< MpWalker, int64_t > GetInt64() const noexcept
int64_t型に格納できる整数値が格納されている場合、整数値を取得します。戻り値のMpWalkerオブジェクトは、...
#define NLIB_NOEXCEPT
環境に合わせてnoexcept 又は同等の定義がされます。
#define NLIB_CEXPR
利用可能であればconstexprが定義されます。そうでない場合は空文字列です。
std::tuple< MpWalker, const nlib_utf8_t *, uint32_t > GetString() const noexcept
文字列が格納されている場合、文字列(str format)を取得します。
std::pair< MpWalker, nlib_time > GetTimestamp() const noexcept
タイムスタンプ拡張型がが格納されている場合、nlib_time型の値として取得します。戻り値のMpWalkerオブジェ...
std::pair< MpWalker, uint32_t > GetMapCount() const noexcept
連想配列が格納されている場合、連想配列のサイズを取得します。
メモリ上に展開されたMessagePackのデータに高速にアクセスします。
bool Init(const void *p, size_t n) noexcept
デフォルトコンストラクタを利用した場合はこの関数で初期化します。
constexpr MpWalker(const void *p, size_t n) noexcept
初期化を行うコンストラクタです。
#define NLIB_FINAL
利用可能であればfinalが定義されます。そうでない場合は空文字列です。
std::tuple< MpWalker, int8_t, const nlib_byte_t *, uint32_t > GetExt() const noexcept
拡張データ型が格納されている場合、拡張データ型(ext format)のデータを取得します。
std::pair< MpWalker, uint64_t > GetUint64() const noexcept
uint64_t型に格納できる整数値が格納されている場合、整数値を取得します。戻り値のMpWalkerオブジェクトは...
std::pair< MpWalker, double > GetDouble() const noexcept
double型に格納できる数値が格納されている場合、数値を取得します。戻り値のMpWalkerオブジェクトは、成功...
std::pair< MpWalker, uint32_t > GetUint32() const noexcept
uint32_t型に格納できる整数値が格納されている場合、整数値を取得します。戻り値のMpWalkerオブジェクトは...
std::pair< MpWalker, float > GetFloat() const noexcept
float型に格納できる数値が格納されている場合、数値を取得します。戻り値のMpWalkerオブジェクトは、成功し...
std::pair< MpWalker, int32_t > GetInt32() const noexcept
int32_t型に格納できる整数値が格納されている場合、整数値を取得します。戻り値のMpWalkerオブジェクトは、...