nlib
|
Quickly accesses MessagePack
expanded in memory.
More...
#include "nn/nlib/msgpack/MpWalker.h"
Public Member Functions | |
const nlib_byte_t * | GetPtr () const noexcept |
Gets a pointer to the current location of MessagePack data. More... | |
size_t | GetSize () const noexcept |
Gets the size of the MessagePack data. More... | |
MpWalker | Skip () const noexcept |
Returns the MpWalker object pointing to the data following the next data by skipping it. In the case of an array or an associative array, the all of it is skipped. | |
operator bool () const | |
Returns true if the object is initialized and readable. | |
Constructor, Destructor, and Initialization | |
constexpr | MpWalker () noexcept |
Instantiates the object with default parameters (default constructor). | |
constexpr | MpWalker (const void *p, size_t n) noexcept |
The constructor to initialize. More... | |
bool | Init (const void *p, size_t n) noexcept |
Initialize with this function when using the default constructor. More... | |
Array | |
MpWalker | operator[] (size_t array_idx) const noexcept |
Specifies an index and accesses the element in the array. | |
MpWalker | operator[] (int array_idx) const noexcept |
Specifies an index and accesses the element in the array. | |
MpWalker | At (size_t idx) const noexcept |
Specifies an index and accesses the element in the array. More... | |
MpWalker | GetArrayCount (uint32_t *n) const noexcept |
If an array is stored, gets the array size. More... | |
std::pair< MpWalker, uint32_t > | GetArrayCount () const noexcept |
If an array is stored, gets the array size. More... | |
Associative Array | |
MpWalker | operator[] (const nlib_utf8_t *key) const noexcept |
Specifies a string and accesses the element in the associative array. | |
MpWalker | At (size_t idx, const nlib_utf8_t **key, size_t *n) const noexcept |
Specifies an index and accesses the element in the associative array. More... | |
MpWalker | Find (const nlib_utf8_t *key) const noexcept |
Specifies a string and accesses the element in the associative array. More... | |
MpWalker | GetMapCount (uint32_t *n) const noexcept |
If an associative array is stored, gets the associative array size. More... | |
std::pair< MpWalker, uint32_t > | GetMapCount () const noexcept |
If an associative array is stored, gets the associative array size. More... | |
String | |
MpWalker | GetString (const nlib_utf8_t **str, uint32_t *n) const noexcept |
Gets the str format data. More... | |
std::tuple< MpWalker, const nlib_utf8_t *, uint32_t > | GetString () const noexcept |
If a string is stored, gets the string (str format ). More... | |
Binary | |
MpWalker | GetBinary (const void **bin, uint32_t *n) const noexcept |
Gets the bin format data. More... | |
std::tuple< MpWalker, const nlib_byte_t *, uint32_t > | GetBinary () const noexcept |
If a string is stored, gets the binary (bin format ) data. More... | |
Extended Data | |
MpWalker | GetExt (int8_t *tp, const void **bin, uint32_t *n) const noexcept |
Gets the ext format data. More... | |
MpWalker | GetTimestamp (nlib_time *val) const noexcept |
Obtains the timestamp. More... | |
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. More... | |
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, the MpWalker object, points to the next element if successful, or is an invalid value if failed. More... | |
Null and Boolean Values | |
MpWalker | GetNil () const noexcept |
Gets nil . More... | |
MpWalker | GetBoolean (bool *val) const noexcept |
If a boolean value is stored, gets the boolean value. More... | |
std::pair< MpWalker, bool > | GetBoolean () const noexcept |
If a boolean value is stored, gets the boolean value. The return value, the MpWalker object, points to the next element if successful, or is an invalid value if failed. More... | |
Numerical Value | |
MpWalker | GetInt (int32_t *val) const noexcept |
Gets a signed integer value. More... | |
MpWalker | GetInt (int64_t *val) const noexcept |
Gets a signed integer value. More... | |
MpWalker | GetUint (uint32_t *val) const noexcept |
Gets an unsigned integer value. More... | |
MpWalker | GetUint (uint64_t *val) const noexcept |
Gets an unsigned integer value. More... | |
MpWalker | GetFloat (float *val) const noexcept |
Gets a single-precision floating-point number. More... | |
MpWalker | GetDouble (double *val) const noexcept |
Gets a double-precision floating-point number. More... | |
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. More... | |
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. More... | |
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. The return value, the MpWalker object, points to the next element if successful, or is an invalid value if failed. More... | |
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. The return value, the MpWalker object, points to the next element if successful, or is an invalid value if failed. More... | |
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. The return value, the MpWalker object, points to the next element if successful, or is an invalid value if failed. More... | |
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. The return value, the MpWalker object, points to the next element if successful, or is an invalid value if failed. More... | |
Quickly accesses MessagePack
expanded in memory.
MpObject
when using JsonStreamParser
to read MessagePack data. Though this behavior is useful, an overhead caused by, for example, MpObject
built even for unnecessary data may pose an issue. MessagePack
data more efficiently by building the MpObject
for only the necessary data. To do this, use MpWalker
to specify the key of an associative array or an index of an array, move to the required location, and then use JsonStreamParser
. MpObject
using only information under the key
attribute by skipping. Definition at line 36 of file MpWalker.h.
|
inlinenoexcept |
The constructor to initialize.
[in] | p | Pointer to MessagePack data. |
[in] | n | Data size. |
Definition at line 39 of file MpWalker.h.
|
noexcept |
Specifies an index and accesses the element in the array.
[in] | idx | The array index. |
MpWalker
object pointing to the value of an array element.MpWalker
indicating an array element. If not an array, or the specified index does not exist, returns an MpWalker
object constructed by the default constructor.
|
noexcept |
Specifies an index and accesses the element in the associative array.
[in] | idx | Index of the associative array index. |
[out] | key | Corresponding key of the associative array (Not null terminated). |
[out] | n | Length of the key of the corresponding associative array. |
MpWalker
object pointing to the value of an associative array.
|
noexcept |
Specifies a string and accesses the element in the associative array.
[in] | key | Associative array key. |
MpWalker
object pointing to the value of an associative array.MpWalker
indicating an associative array element. If not an associative array, or the specified index does not exist, returns an MpWalker
object constructed by the default constructor.
|
noexcept |
If an array is stored, gets the array size.
[out] | n | Size of the array. |
MpWalker
object pointing to the next element (the first element in the array).
|
inlinenoexcept |
If an array is stored, gets the array size.
MpWalker
object and the array size.MpWalker
object, points to the next element (the first element in an array) if successful, or is an invalid value if failed. Definition at line 106 of file MpWalker.h.
|
noexcept |
Gets the bin format
data.
[out] | bin | Pointer to the binary. |
[out] | n | Length of the binary. |
MpWalker
object pointing to the next element.
|
inlinenoexcept |
If a string is stored, gets the binary (bin format
) data.
MpWalker
object, a pointer to binary, and the binary length. Definition at line 87 of file MpWalker.h.
|
noexcept |
If a boolean value is stored, gets the boolean value.
[out] | val | Pointer to the boolean value. |
MpWalker
object pointing to the next element.
|
inlinenoexcept |
If a boolean value is stored, gets the boolean value. The return value, the MpWalker
object, points to the next element if successful, or is an invalid value if failed.
MpWalker
object and a boolean value. Definition at line 111 of file MpWalker.h.
|
noexcept |
Gets a double-precision floating-point number.
[out] | val | Pointer to the double-precision floating-point number. |
MpWalker
object pointing to the next element.
|
inlinenoexcept |
If a numerical value that can be stored in the double
type is stored, gets the numerical value. The return value, the MpWalker
object, points to the next element if successful, or is an invalid value if failed.
MpWalker
object and the double
type value. Definition at line 141 of file MpWalker.h.
|
noexcept |
Gets the ext format
data.
[out] | tp | Numeric value indicating the object type. |
[out] | bin | Pointer to the binary. |
[out] | n | Length of the binary. |
MpWalker
object pointing to the next element.
|
inlinenoexcept |
If the extended data type is stored, gets extended data type (ext format
) data.
MpWalker
object, a numerical value indicating the object type, a pointer to the binary, and the binary length. Definition at line 93 of file MpWalker.h.
|
noexcept |
Gets a single-precision floating-point number.
[out] | val | Pointer to the single-precision floating-point number. |
MpWalker
object pointing to the next element.
|
inlinenoexcept |
If a numerical value that can be stored in the float
type is stored, gets the numerical value. The return value, the MpWalker
object, points to the next element if successful, or is an invalid value if failed.
MpWalker
object and the float
type value. Definition at line 136 of file MpWalker.h.
|
noexcept |
Gets a signed integer value.
[out] | val | Pointer to the signed integer value. |
MpWalker
object pointing to the next element.
|
noexcept |
Gets a signed integer value.
[out] | val | Pointer to the signed integer value. |
MpWalker
object pointing to the next element.
|
inlinenoexcept |
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.
MpWalker
object and the int32_t
type value. Definition at line 116 of file MpWalker.h.
|
inlinenoexcept |
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.
MpWalker
object and the int64_t
type value. Definition at line 121 of file MpWalker.h.
|
noexcept |
If an associative array is stored, gets the associative array size.
[out] | n | Size of the associative array. |
MpWalker
object pointing to the next element (the first key in the associative array).
|
inlinenoexcept |
If an associative array is stored, gets the associative array size.
MpWalker
object and the associative array size.MpWalker
object, points to the next element (the first key in an associative array) if successful, or is an invalid value if failed. Definition at line 101 of file MpWalker.h.
|
noexcept |
Gets nil
.
MpWalker
object pointing to the next element.
|
inlinenoexcept |
Gets a pointer to the current location of MessagePack data.
Definition at line 57 of file MpWalker.h.
|
inlinenoexcept |
Gets the size of the MessagePack data.
Definition at line 60 of file MpWalker.h.
|
noexcept |
Gets the str format
data.
[out] | str | Pointer to the string (Not null terminated). |
[out] | n | Length of the string. |
MpWalker
object pointing to the next element.
|
inlinenoexcept |
If a string is stored, gets the string (str format
).
MpWalker
object, a pointer to the string, and the string length.Definition at line 82 of file MpWalker.h.
|
noexcept |
Obtains the timestamp.
[out] | val | Pointer to the time value. |
MpWalker
object pointing to the next element.
|
inlinenoexcept |
If the timestamp extended type is stored, gets data as the nlib_time
type value. The return value, the MpWalker
object, points to the next element if successful, or is an invalid value if failed.
MpWalker
object and the nlib_time
type value. Definition at line 146 of file MpWalker.h.
|
noexcept |
Gets an unsigned integer value.
[out] | val | Pointer to the unsigned integer value. |
MpWalker
object pointing to the next element.
|
noexcept |
Gets an unsigned integer value.
[out] | val | Pointer to the unsigned integer value. |
MpWalker
object pointing to the next element.
|
inlinenoexcept |
If an integer that can be stored in the uint32_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.
MpWalker
object and the uint32_t
type value. Definition at line 126 of file MpWalker.h.
|
inlinenoexcept |
If an integer that can be stored in the uint64_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.
MpWalker
object and the uint64_t
type value. Definition at line 131 of file MpWalker.h.
|
inlinenoexcept |
Initialize with this function when using the default constructor.
[in] | p | Pointer to MessagePack data. |
[in] | n | Data size. |
true
on success. (Always successful.) Definition at line 42 of file MpWalker.h.
© Nintendo Co., Ltd. All rights reserved.