A strict RFC 9535 JSONPath implementation. More...
Classes | |
| class | sourcemeta::core::JSONPath |
| class | sourcemeta::core::JSONPathParseError |
A strict RFC 9535 JSONPath implementation.
This functionality is included as follows:
| class sourcemeta::core::JSONPath |
A parsed RFC 9535 JSONPath query that can be evaluated many times.
Public Types | |
| enum class | FilterFunctionName : std::uint8_t { Length , Count , Match , Search , Value } |
| The function extensions that filter expressions can invoke. More... | |
| enum class | FilterComparisonOperator : std::uint8_t { Equal , NotEqual , Less , LessEqual , Greater , GreaterEqual } |
| The operators that filter comparisons can use. More... | |
| enum class | SegmentKind : std::uint8_t { SingleName , SingleIndex , General } |
| The precomputed shape of a query segment. More... | |
| using | Callback |
| The callback invoked for every query result node. | |
| using | Selector |
| A single selector within a query segment. | |
Public Member Functions | |
| JSONPath (const JSON::StringView expression) | |
| auto | evaluate (const JSON &document, const Callback &callback) const -> void |
| auto | to_json () const -> JSON |
Static Public Member Functions | |
| static auto | normalize (const WeakPointer &location) -> JSON::String |
| static auto | from_json (const JSON &value) -> std::optional< JSONPath > |
The callback invoked for every query result node.
A single selector within a query segment.
|
strong |
The operators that filter comparisons can use.
|
strong |
The function extensions that filter expressions can invoke.
|
strong |
|
explicit |
Parse a query expression, throwing on invalid input. For example:
| auto sourcemeta::core::JSONPath::evaluate | ( | const JSON & | document, |
| const Callback & | callback ) const -> void |
Evaluate the query against a document, invoking the callback once per result node. For example:
|
staticnodiscard |
Deserialize a query from its expression string as JSON, returning no result on invalid input. For example:
|
staticnodiscard |
Serialize a location into the RFC 9535 normalized path form. For example:
|
nodiscard |
Serialize the query into its expression string as JSON. For example:
| class sourcemeta::core::JSONPathParseError |
An error that represents a JSONPath parsing failure
Public Member Functions | |
| JSONPathParseError (const std::uint64_t column) | |
| Construct an error given the column number where parsing failed. | |
| auto | column () const noexcept -> std::uint64_t |
| Get the column number of the error. | |