MySQL 8.4.2
Source Code Documentation
Json_array_index Class Referencefinal

A class that represents the index of an element in a JSON array. More...

#include <json_path.h>

Public Member Functions

 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...
 

Private Attributes

size_t m_index
 The array index. More...
 
bool m_within_bounds
 True if the array index is within the bounds of the array. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ 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
indexthe array index
from_endtrue if index is relative to the end of the array
array_lengththe length of the array

Member Function Documentation

◆ 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
trueif the array index is within bounds
falseotherwise

Member Data Documentation

◆ 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: