The class for providing access with MpObject
stored in an array as an element for MpObject
that has an array type.
More...
#include "nn/nlib/msgpack/MpObject.h"
The class for providing access with MpObject
stored in an array as an element for MpObject
that has an array type.
- Description
- The
begin()
and end()
functions are defined for arrays and you can write a loop as follows. const char* json = R"([1,2,3])";
auto obj = ToMpObject(json);
for (auto& item : obj->AsArray()) {
int val;
item.Unbox(&val);
}
Definition at line 440 of file MpObject.h.
◆ MpObjectAsArray()
nn::nlib::msgpack::MpObjectAsArray::MpObjectAsArray |
( |
MpObject & |
obj | ) |
|
|
inlineexplicitnoexcept |
- Parameters
-
[in] | obj | MpObject to be accessed as an array. obj.IsArray() must be true. |
Definition at line 452 of file MpObject.h.
◆ Erase() [1/2]
nn::nlib::msgpack::MpObjectAsArray::Erase |
( |
iterator |
it | ) |
|
|
noexcept |
Removes the element found in it.
- Parameters
-
[in] | it | The position of the element to remove. |
- Returns
- Returns
0
on success. Any value other than 0
indicates an error.
◆ Erase() [2/2]
nn::nlib::msgpack::MpObjectAsArray::Erase |
( |
size_t |
n | ) |
|
|
inlinenoexcept |
Removes the nth element.
- Parameters
-
[in] | n | An integer equal to or greater than 0. |
- Return values
-
0 | Success. |
ERANGE | Indicates that n is out of the range. |
Definition at line 496 of file MpObject.h.
◆ Insert() [1/2]
Inserts rhs immediately before the element found in it.
- Parameters
-
[in] | it | The position to be inserted. |
[in,out] | rhs | An element to be inserted. |
- Returns
- Returns
0
on success. Any value other than 0
indicates an error.
◆ Insert() [2/2]
nn::nlib::msgpack::MpObjectAsArray::Insert |
( |
size_t |
n, |
|
|
MpObject && |
rhs |
|
) |
| |
|
inlinenoexcept |
Inserts rhs immediately before the nth element.
- Parameters
-
[in] | n | The element insertion position. |
[in,out] | rhs | An element to be inserted. |
- Returns
- Returns
0
on success. Any value other than 0
indicates an error.
Definition at line 489 of file MpObject.h.
◆ operator[]()
nn::nlib::msgpack::MpObjectAsArray::operator[] |
( |
size_t |
n | ) |
|
|
inlinenoexcept |
Gets the nth element. n must be less than the number of stored elements.
- Parameters
-
[in] | n | The position of an element. |
- Returns
- Reference to the nth element.
Definition at line 463 of file MpObject.h.
◆ PopBack()
nn::nlib::msgpack::MpObjectAsArray::PopBack |
( |
| ) |
|
|
inlinenoexcept |
Removes the end element.
- Returns
- Returns
0
on success. Any value other than 0
indicates an error.
Definition at line 503 of file MpObject.h.
◆ PushBack()
nn::nlib::msgpack::MpObjectAsArray::PushBack |
( |
MpObject && |
rhs | ) |
|
|
inlinenoexcept |
Adds an element to the end of an array. The content in rhs is moved.
- Parameters
-
[in,out] | rhs | An element to add to the end of an array. |
- Returns
- Returns
0
on success. Any value other than 0
indicates an error.
Definition at line 481 of file MpObject.h.
◆ Resize()
nn::nlib::msgpack::MpObjectAsArray::Resize |
( |
size_t |
n | ) |
|
|
inlinenoexcept |
Changes the number of elements for an array.
- Parameters
-
[in] | n | Size after resizing. |
- Returns
- Returns
0
on success. Any value other than 0
indicates an error.
Definition at line 472 of file MpObject.h.
The documentation for this class was generated from the following files: