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
If a string is stored, gets the binary (bin format) data.
#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...
std::pair< MpWalker, uint32_t > GetArrayCount() const noexcept
If an array is stored, gets the array size.
constexpr MpWalker() noexcept
Instantiates the object with default parameters (default constructor).
size_t GetSize() const noexcept
Gets the size of the MessagePack data.
MpWalker operator[](int array_idx) const noexcept
Specifies an index and accesses the element in the array.
const nlib_byte_t * GetPtr() const noexcept
Gets a pointer to the current location of MessagePack data.
std::pair< MpWalker, bool > GetBoolean() const noexcept
If a boolean value is stored, gets the boolean value. The return value, the MpWalker object...
std::pair< MpWalker, int64_t > GetInt64() const noexcept
If an integer that can be stored in the int64_t type is stored, gets the integer value. The return value, the MpWalker object, points to the next element if successful, or is an invalid value if failed.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
#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.
std::tuple< MpWalker, const nlib_utf8_t *, uint32_t > GetString() const noexcept
If a string is stored, gets the string (str format).
std::pair< MpWalker, nlib_time > GetTimestamp() const noexcept
If the timestamp extended type is stored, gets data as the nlib_time type value. The return value...
std::pair< MpWalker, uint32_t > GetMapCount() const noexcept
If an associative array is stored, gets the associative array size.
Quickly accesses MessagePack expanded in memory.
bool Init(const void *p, size_t n) noexcept
Initialize with this function when using the default constructor.
constexpr MpWalker(const void *p, size_t n) noexcept
The constructor to initialize.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
std::tuple< MpWalker, int8_t, const nlib_byte_t *, uint32_t > GetExt() const noexcept
If the extended data type is stored, gets extended data type (ext format) data.
std::pair< MpWalker, uint64_t > GetUint64() const noexcept
If an integer that can be stored in the uint64_t type is stored, gets the integer value...
std::pair< MpWalker, double > GetDouble() const noexcept
If a numerical value that can be stored in the double type is stored, gets the numerical value...
std::pair< MpWalker, uint32_t > GetUint32() const noexcept
If an integer that can be stored in the uint32_t type is stored, gets the integer value...
std::pair< MpWalker, float > GetFloat() const noexcept
If a numerical value that can be stored in the float type is stored, gets the numerical value...
std::pair< MpWalker, int32_t > GetInt32() const noexcept
If an integer that can be stored in the int32_t type is stored, gets the integer value. The return value, the MpWalker object, points to the next element if successful, or is an invalid value if failed.