|
jmespath.cpp
C++ implementation of JMESPath, a query language for JSON http://jmespath.org
|
Classes | |
| class | jmespath::Expression |
| The Expression class represents a JMESPath expression. More... | |
Functions | |
| template<typename JsonT > | |
| std::enable_if_t< std::is_same < std::decay_t< JsonT >, Json > ::value, Json > | jmespath::search (const Expression &expression, JsonT &&document) |
| Finds or creates the results for the expression evaluated on the given document. More... | |
| class jmespath::Expression |
The Expression class represents a JMESPath expression.
The Expression class can be used to store a parsed JMESPath expression and reuse it for multiple searches.
Public Member Functions | |
| Expression () | |
| Constructs an empty Expression object. More... | |
| Expression (const Expression &other) | |
| Constructs a copy of other. More... | |
| Expression (Expression &&other) | |
| Move-constructs an Expression by moving the value of other to this object. More... | |
| template<typename U , typename std::enable_if< std::is_convertible< U, String >::value >::type * = nullptr> | |
| Expression (U &&expression) | |
| Constructs an Expression object by forwarding argument. More... | |
| Expression & | operator= (const Expression &other) |
| Assigns other to this expression and returns a reference to this expression. More... | |
| Expression & | operator= (Expression &&other) |
| Move-assigns other to this expression and returns a reference to this expression. More... | |
| bool | operator== (const Expression &other) const |
| Equality compares this expression to the other. More... | |
| String | toString () const |
| Converts the expression to the string representation of the JMESPath expression. More... | |
| bool | isEmpty () const |
| Checks whether this object has been initialized. expression. More... | |
| const ast::ExpressionNode * | astRoot () const |
| Returns a pointer to the root expression in the abstract syntax tree. More... | |
Private Member Functions | |
| void | parseExpression (const String &expressionString) |
| Parses the expressionString and updates the AST. More... | |
Private Attributes | |
| String | m_expressionString |
| The string representation of the JMESPath expression. More... | |
| std::unique_ptr < ast::ExpressionNode, ExpressionDeleter > | m_astRoot |
| The root node of the ast. More... | |
| jmespath::Expression::Expression | ( | ) |
Constructs an empty Expression object.
| jmespath::Expression::Expression | ( | const Expression & | other | ) |
Constructs a copy of other.
| [in] | other | The object that should be copied. |
| jmespath::Expression::Expression | ( | Expression && | other | ) |
Move-constructs an Expression by moving the value of other to this object.
| [in] | other | The object whose value should be mvoed. |
|
inline |
Constructs an Expression object by forwarding argument.
This constructor participates in overload resolution only if U is implicitly convertible to String. Argument should describe a valid JMESPath expression.
| [in] | argument | The value that should be forwarded. |
| U | The type of argument. |
| SyntaxError | When the syntax of the specified expression is invalid. |
| const ast::ExpressionNode * jmespath::Expression::astRoot | ( | ) | const |
Returns a pointer to the root expression in the abstract syntax tree.
nullptr if the object is empty. | bool jmespath::Expression::isEmpty | ( | ) | const |
Checks whether this object has been initialized. expression.
| Expression & jmespath::Expression::operator= | ( | const Expression & | other | ) |
Assigns other to this expression and returns a reference to this expression.
| [in] | other | The expression that should be assigned. |
| Expression & jmespath::Expression::operator= | ( | Expression && | other | ) |
Move-assigns other to this expression and returns a reference to this expression.
| [in] | other | The expression that should be moved. |
| bool jmespath::Expression::operator== | ( | const Expression & | other | ) | const |
Equality compares this expression to the other.
| [in] | other | The expression that should be compared. |
|
private |
Parses the expressionString and updates the AST.
| [in] | expressionString | The string representation of the JMESPath expression. |
| SyntaxError | When the syntax of the specified expressionString is invalid. |
| String jmespath::Expression::toString | ( | ) | const |
Converts the expression to the string representation of the JMESPath expression.
|
private |
The root node of the ast.
|
private |
The string representation of the JMESPath expression.
| std::enable_if_t< std::is_same< std::decay_t< JsonT >, Json >::value, Json > jmespath::search | ( | const Expression & | expression, |
| JsonT && | document | ||
| ) |
Finds or creates the results for the expression evaluated on the given document.
The expression string should be encoded in UTF-8.
| expression | JMESPath expression. |
| document | Input JSON document |
| InvalidAgrument | If a precondition fails. Usually signals an internal error. |
| InvalidValue | When an invalid value is specified for an expression. For example a 0 step value for a slice expression. |
| UnknownFunction | When an unknown JMESPath function is called in the expression. |
| InvalidFunctionArgumentArity | When a JMESPath function is called with an unexpected number of arguments in the expression. |
| InvalidFunctionArgumentType | When an invalid type of argument was specified for a JMESPath function call in the expression. |
1.8.6