jmespath.cpp
C++ implementation of JMESPath, a query language for JSON http://jmespath.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Classes | Typedefs | Functions
jmespath::interpreter Namespace Reference

Classes for interpreting the AST of the JMESPath expression. More...

Classes

class  AbstractVisitor
 The AbstractVisitor class is an interface which defines the member functions required to visit every type of AST node. More...
 
class  ContextValueVisitorAdaptor
 The ContextValueVisitorAdaptor class adapts a visitor object, which is callable with const lvalue reference of Json and with rvalue reference of Json objects, to ContextValue objects. More...
 
class  Interpreter
 The Interpreter class evaluates the AST structure on a Json context. More...
 

Typedefs

using JsonRef = std::reference_wrapper< const Json >
 Copyable and assignable reference to a constant Json value. More...
 
using ContextValue = boost::variant< Json, JsonRef >
 Evaluation context type. More...
 

Functions

decltype(auto) makeVisitor (std::function< void(const Json &)> &&lvalueFunc, std::function< void(Json &&)> &&rvalueFunc)
 Create visitor object which accepts ContextValue objects, and calls lvalueFunc callable with a const lvalue ref of the Json reference held by the ContextValue or calls the rvalueFunc callable with an rvalue ref of the Json object held by ContextValue. More...
 
decltype(auto) makeMoveOnlyVisitor (std::function< void(Json &&)> rvalueFunc)
 Create visitor object which accepts ContextValue objects, and calls the rvalueFunc callable with an rvalue ref of the Json object held by the ContextValue or calls it with the rvalue ref of the copy of the object to which the Json reference points in the ContextValue object. More...
 
Json && assignContextValue (Json &&value)
 Convert the given value to something assignable to a ContextValue variable. More...
 
JsonRef assignContextValue (const Json &value)
 Convert the given value to something assignable to a ContextValue variable. More...
 
const JsongetJsonValue (const ContextValue &contextValue)
 Extract the Json value held by the given value. More...
 

Detailed Description

Classes for interpreting the AST of the JMESPath expression.

Typedef Documentation

using jmespath::interpreter::ContextValue = typedef boost::variant<Json, JsonRef>

Evaluation context type.

It can hold either a Json value or a JsonRef.

using jmespath::interpreter::JsonRef = typedef std::reference_wrapper<const Json>

Copyable and assignable reference to a constant Json value.

Function Documentation

Json&& jmespath::interpreter::assignContextValue ( Json &&  value)
inline

Convert the given value to something assignable to a ContextValue variable.

Parameters
[in]valueA Json value.
Returns
Returns the parameter without any changes as an rvalue reference.
JsonRef jmespath::interpreter::assignContextValue ( const Json &  value)
inline

Convert the given value to something assignable to a ContextValue variable.

Parameters
[in]valueA Json value.
Returns
Returns a JsonRef which refers to the given value.
const Json& jmespath::interpreter::getJsonValue ( const ContextValue &  contextValue)
inline

Extract the Json value held by the given value.

Parameters
[in]contextValueA ContextValue variable.
Returns
Returns a constant reference to the Json value held by value.
decltype(auto) jmespath::interpreter::makeMoveOnlyVisitor ( std::function< void(Json &&)>  rvalueFunc)
inline

Create visitor object which accepts ContextValue objects, and calls the rvalueFunc callable with an rvalue ref of the Json object held by the ContextValue or calls it with the rvalue ref of the copy of the object to which the Json reference points in the ContextValue object.

Parameters
[in]rvalueFuncA callable taking an rvalue reference to Json.
Returns
A visitor object which accepts ContextValue objects
decltype(auto) jmespath::interpreter::makeVisitor ( std::function< void(const Json &)> &&  lvalueFunc,
std::function< void(Json &&)> &&  rvalueFunc 
)
inline

Create visitor object which accepts ContextValue objects, and calls lvalueFunc callable with a const lvalue ref of the Json reference held by the ContextValue or calls the rvalueFunc callable with an rvalue ref of the Json object held by ContextValue.

Parameters
[in]lvalueFuncA callable taking a const lvalue reference to Json.
[in]rvalueFuncA callable taking an rvalue reference to Json.
Returns
A visitor object which accepts ContextValue objects