nlib
|
The class for providing access with a pair of the key and the value as an element for MpObject
that has an associative array type.
More...
#include "nn/nlib/msgpack/MpObject.h"
Public Types | |
typedef Nlist< MpObjectKv >::iterator | iterator |
A forward iterator. | |
typedef Nlist< MpObjectKv >::const_iterator | const_iterator |
Read-only forward iterator. | |
typedef MpObjectKv & | reference |
A reference to an element. | |
typedef const MpObjectKv & | const_reference |
Read-only reference to an element. | |
typedef MpObjectKv * | pointer |
Pointer to the element. | |
typedef const MpObjectKv * | const_pointer |
Read-only pointer to an element. | |
Public Member Functions | |
MpObjectAsMap (MpObject &obj) noexcept | |
iterator | begin () noexcept |
Gets the iterator pointing to the first element. | |
iterator | end () noexcept |
Gets the iterator pointing beyond the last element. | |
const_iterator | begin () const noexcept |
Gets the read-only iterator pointing to the first element. | |
const_iterator | end () const noexcept |
Gets the read-only iterator pointing beyond the last element. | |
reference | operator[] (size_t n) noexcept |
Gets the nth element. n must be less than the number of stored elements. More... | |
const_reference | operator[] (size_t n) const noexcept |
The const decoration version of the above function. | |
iterator | GetByKey (const MpObject &key) noexcept |
Gets the iterator pointing to a pair of the key and the value that has key as the key. More... | |
const_iterator | GetByKey (const MpObject &key) const noexcept |
The const decoration version of the above function. | |
template<class StringIterator > | |
iterator | GetByKey (StringIterator first, StringIterator last) noexcept |
Gets the iterator pointing to a pair of the key and the value that has the specified key. More... | |
template<class StringIterator > | |
const_iterator | GetByKey (StringIterator first, StringIterator last) const noexcept |
The const decoration version of the above function. | |
iterator | GetByKey (const nlib_utf8_t *key) noexcept |
Gets the iterator pointing to a pair of the key and the value that has the specified key. More... | |
const_iterator | GetByKey (const nlib_utf8_t *key) const noexcept |
The const decoration version of the above function. | |
uint32_t | GetSize () const noexcept |
Returns the number of stored elements. | |
errno_t | Resize (size_t n) noexcept |
Changes the number of elements for an associative array. More... | |
errno_t | PushBack (MpObjectKv &&rhs) noexcept |
Adds a pair of the key and the value to the end of an associative array. The content in rhs is moved. More... | |
errno_t | PushBack (const nlib_utf8_t *key, MpObject &&value) noexcept |
Adds a pair of the key and the value to the end of an associative array. The content in value is moved. More... | |
errno_t | PopBack () noexcept |
Removes the end element. More... | |
errno_t | Erase (iterator it) noexcept |
Removes a pair of the key and the value specified by it. More... | |
errno_t | Erase (size_t n) noexcept |
Removes the pair of the nth key in an associative array and the value. More... | |
errno_t | Erase (const nlib_utf8_t *key) noexcept |
Removes one pair of the key and the value that has key as the key from an associative array. More... | |
The class for providing access with a pair of the key and the value as an element for MpObject
that has an associative array type.
begin()
and end()
functions are defined for associative arrays and you can write a loop as follows. Definition at line 534 of file MpObject.h.
|
inlineexplicitnoexcept |
[in] | obj | MpObject to be accessed as an associative array. obj.IsMap() must be true. |
Definition at line 546 of file MpObject.h.
|
noexcept |
Removes a pair of the key and the value specified by it.
[in] | it | The iterator pointing to a pair of the key and the value. |
0 | Success. |
ERANGE | Indicates that it is out of the range. |
|
inlinenoexcept |
Removes the pair of the nth key in an associative array and the value.
[in] | n | An integer equal to or greater than 0. |
0 | Success. |
ERANGE | Indicates that n is out of the range. |
Definition at line 601 of file MpObject.h.
|
noexcept |
Removes one pair of the key and the value that has key as the key from an associative array.
[in] | key | A key string. |
0 | Success. |
ENOENT | Indicates that a pair of the corresponding key and the value does not exist. |
|
noexcept |
Gets the iterator pointing to a pair of the key and the value that has key as the key.
[in] | key | The search-target key. |
|
noexcept |
Gets the iterator pointing to a pair of the key and the value that has the specified key.
StringIterator | The iterator for strings such as std::string::iterator . |
[in] | first | The first character of the key string. |
[in] | last | The last character of the key string. |
end()
if the lement does not exists. If there are multiple elements with the same key, the closest element to the first character is returned. Definition at line 802 of file MpObject.h.
|
noexcept |
Gets the iterator pointing to a pair of the key and the value that has the specified key.
[in] | key | A key string. |
end()
if the lement does not exists. If there are multiple elements with the same key, the closest element to the first character is returned.
|
inlinenoexcept |
Gets the nth element. n must be less than the number of stored elements.
[in] | n | The position of an element. |
Definition at line 551 of file MpObject.h.
|
inlinenoexcept |
Removes the end element.
0
on success. Any value other than 0
indicates an error. Definition at line 592 of file MpObject.h.
|
inlinenoexcept |
Adds a pair of the key and the value to the end of an associative array. The content in rhs is moved.
[in,out] | rhs | A pair of the key and the value to add to the end of an associative array. |
0
on success. Any value other than 0
indicates an error. Definition at line 578 of file MpObject.h.
|
inlinenoexcept |
Adds a pair of the key and the value to the end of an associative array. The content in value is moved.
[in] | key | A key. |
[in,out] | value | The value corresponding to a key. |
0
on success. Any value other than 0
indicates an error. Definition at line 584 of file MpObject.h.
|
inlinenoexcept |
Changes the number of elements for an associative array.
[in] | n | Size after resizing. |
0
on success. Any value other than 0
indicates an error. Definition at line 569 of file MpObject.h.
© Nintendo Co., Ltd. All rights reserved.