A class that represents the index of an element in a JSON array.
More...
#include <json_path.h>
|
| Json_array_index (size_t index, bool from_end, size_t array_length) |
| Construct a new Json_array_index object representing the specified position in an array of the given length. More...
|
|
bool | within_bounds () const |
| Is the array index within the bounds of the array? More...
|
|
size_t | position () const |
| Get the position in the array pointed to by this array index. More...
|
|
A class that represents the index of an element in a JSON array.
The index is 0-based and relative to the beginning of the array.
◆ Json_array_index()
Json_array_index::Json_array_index |
( |
size_t |
index, |
|
|
bool |
from_end, |
|
|
size_t |
array_length |
|
) |
| |
|
inline |
Construct a new Json_array_index object representing the specified position in an array of the given length.
- Parameters
-
index | the array index |
from_end | true if index is relative to the end of the array |
array_length | the length of the array |
◆ position()
size_t Json_array_index::position |
( |
| ) |
const |
|
inline |
Get the position in the array pointed to by this array index.
If the index is out of bounds, 0 will be returned if the array index is before the first element in the array, or a value equal to the length of the array if the index is after the last element.
- Returns
- the position in the array (0-based index relative to the start of the array)
◆ within_bounds()
bool Json_array_index::within_bounds |
( |
| ) |
const |
|
inline |
Is the array index within the bounds of the array?
- Return values
-
true | if the array index is within bounds |
false | otherwise |
◆ m_index
size_t Json_array_index::m_index |
|
private |
The array index.
It is 0 if the specified index was before the first element of the array, or equal to the array length if the specified index was after the last element of the array.
◆ m_within_bounds
bool Json_array_index::m_within_bounds |
|
private |
True if the array index is within the bounds of the array.
The documentation for this class was generated from the following file: