MySQL 9.1.0
Source Code Documentation
|
One path leg in a JSON path expression. More...
#include <json_path.h>
Classes | |
struct | Array_range |
A structure that represents an array range. More... | |
Public Member Functions | |
Json_path_leg (enum_json_path_leg_type leg_type) | |
Construct a wildcard or ellipsis path leg. More... | |
Json_path_leg (size_t index) | |
Construct an array cell path leg. More... | |
Json_path_leg (size_t index, bool from_end) | |
Construct an array cell path leg. More... | |
Json_path_leg (size_t idx1, bool idx1_from_end, size_t idx2, bool idx2_from_end) | |
Construct an array range path leg. More... | |
Json_path_leg (std::string_view member_name) | |
Construct an object member path leg. More... | |
enum_json_path_leg_type | get_type () const |
Get the type of the path leg. More... | |
const std::string & | get_member_name () const |
Get the member name of a jpl_member path leg. More... | |
bool | to_string (String *buf) const |
Turn into a human-readable string. More... | |
bool | is_autowrap () const |
Is this path leg an auto-wrapping array accessor? More... | |
Json_array_index | first_array_index (size_t array_length) const |
Get the first array cell pointed to by an array range, or the array cell pointed to by an array cell index. More... | |
Json_array_index | last_array_index (size_t array_length) const |
Get the last array cell pointed to by an array range. More... | |
Array_range | get_array_range (size_t array_length) const |
Get the array range pointed to by a path leg of type jpl_array_range or jpl_array_cell_wildcard. More... | |
Private Attributes | |
enum_json_path_leg_type | m_leg_type |
The type of this path leg. More... | |
size_t | m_first_array_index = 0 |
The index of an array cell, or the start of an array range. More... | |
bool | m_first_array_index_from_end = false |
Is m_first_array_index relative to the end of the array? More... | |
size_t | m_last_array_index = 0 |
The end (inclusive) of an array range. More... | |
bool | m_last_array_index_from_end = false |
Is m_last_array_index relative to the end of the array? More... | |
std::string | m_member_name |
The member name of a member path leg. More... | |
One path leg in a JSON path expression.
A path leg describes either a key/value pair in an object or a 0-based index into an array.
|
inlineexplicit |
Construct a wildcard or ellipsis path leg.
leg_type | the type of wildcard (jpl_ellipsis, jpl_member_wildcard or jpl_array_cell_wildcard) |
|
inlineexplicit |
Construct an array cell path leg.
index | the 0-based index in the array, relative to the beginning of the array |
|
inline |
Construct an array cell path leg.
index | the 0-based index in the array |
from_end | true if index is relative to the end of the array |
|
inline |
Construct an array range path leg.
idx1 | the start index of the range, inclusive |
idx1_from_end | true if the start index is relative to the end of the array |
idx2 | the last index of the range, inclusive |
idx2_from_end | true if the last index is relative to the end of the array |
|
inlineexplicit |
Construct an object member path leg.
member_name | the name of the object member |
|
inline |
Get the first array cell pointed to by an array range, or the array cell pointed to by an array cell index.
array_length | the length of the array |
Json_path_leg::Array_range Json_path_leg::get_array_range | ( | size_t | array_length | ) | const |
Get the array range pointed to by a path leg of type jpl_array_range or jpl_array_cell_wildcard.
array_length | the length of the array |
|
inline |
Get the member name of a jpl_member path leg.
|
inline |
Get the type of the path leg.
bool Json_path_leg::is_autowrap | ( | ) | const |
Is this path leg an auto-wrapping array accessor?
An auto-wrapping array accessor is an array accessor that matches non-arrays by auto-wrapping them in a single-element array before doing the matching.
This function returns true for any jpl_array_cell or jpl_array_range path leg that would match the element contained in a single-element array, and which therefore would also match non-arrays that have been auto-wrapped in single-element arrays.
|
inline |
Get the last array cell pointed to by an array range.
The range includes this cell.
array_length | the length of the array |
bool Json_path_leg::to_string | ( | String * | buf | ) | const |
Turn into a human-readable string.
|
private |
The index of an array cell, or the start of an array range.
|
private |
Is m_first_array_index relative to the end of the array?
|
private |
The end (inclusive) of an array range.
|
private |
Is m_last_array_index relative to the end of the array?
|
private |
The type of this path leg.
|
private |
The member name of a member path leg.