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
Public Types | Public Member Functions | Public Attributes | List of all members
jmespath::ast::VariantNode< VariantT > Class Template Reference

The VariantNode class serves as a container node which can represent either one of the node types specified in the classes template argument list. More...

#include <variantnode.h>

Inheritance diagram for jmespath::ast::VariantNode< VariantT >:
jmespath::ast::AbstractNode

Public Types

using ValueType = boost::variant< boost::blank, VariantT...>
 The internal variant type which stores the nodes defined in VariantT or boost::blank if it's empty. More...
 

Public Member Functions

 VariantNode ()
 Constructs an empty VariantNode object. More...
 
 VariantNode (const VariantNode &)=default
 Copy-constructs an VariantNode object. More...
 
template<typename T >
 VariantNode (const T &other)
 Copy constructs a VariantNode object if T is VariantNode or constructs a VariantNode object with T as the represented node type with the value given in other. More...
 
VariantNode< VariantT...> & operator= (const VariantNode &other)
 Assigns the other object's value to this object. More...
 
template<typename T >
VariantNode< VariantT...> & operator= (const T &other)
 Assigns the value of the other object to this object's internal variant making it the node that this object represents. More...
 
bool operator== (const VariantNode &other) const
 Equality compares this node to the other. More...
 
bool isNull () const
 Returns whether this object has been initialized. More...
 
void accept (interpreter::AbstractVisitor *visitor) const override
 Accepts the given visitor object. More...
 
- Public Member Functions inherited from jmespath::ast::AbstractNode
 AbstractNode ()=default
 Constructs an AbstractNode object. More...
 
 AbstractNode (const AbstractNode &)=default
 Copy-constructs an AbstractNode object. More...
 
virtual ~AbstractNode ()
 Destroys the AbstractNode object. More...
 
AbstractNodeoperator= (const AbstractNode &)=default
 Copy-assigns the other object to this object. More...
 

Public Attributes

ValueType value
 The variable which stores the node that this object represents. More...
 

Detailed Description

template<typename... VariantT>
class jmespath::ast::VariantNode< VariantT >

The VariantNode class serves as a container node which can represent either one of the node types specified in the classes template argument list.

Template Parameters
VariantTThe list of types that the VariantNode can represent

Member Typedef Documentation

template<typename... VariantT>
using jmespath::ast::VariantNode< VariantT >::ValueType = boost::variant<boost::blank, VariantT...>

The internal variant type which stores the nodes defined in VariantT or boost::blank if it's empty.

Constructor & Destructor Documentation

template<typename... VariantT>
jmespath::ast::VariantNode< VariantT >::VariantNode ( )
inline

Constructs an empty VariantNode object.

template<typename... VariantT>
jmespath::ast::VariantNode< VariantT >::VariantNode ( const VariantNode< VariantT > &  )
default

Copy-constructs an VariantNode object.

template<typename... VariantT>
template<typename T >
jmespath::ast::VariantNode< VariantT >::VariantNode ( const T &  other)
inline

Copy constructs a VariantNode object if T is VariantNode or constructs a VariantNode object with T as the represented node type with the value given in other.

Member Function Documentation

template<typename... VariantT>
void jmespath::ast::VariantNode< VariantT >::accept ( interpreter::AbstractVisitor visitor) const
inlineoverridevirtual

Accepts the given visitor object.

Subclasses should implement this function by calling the visit method of the visitor with a pointer to the node object itself and the accept method of the node's member nodes with the visitor as the parameter.

Parameters
[in]visitorAn interpreter::AbstractVisitor object

Implements jmespath::ast::AbstractNode.

template<typename... VariantT>
bool jmespath::ast::VariantNode< VariantT >::isNull ( ) const
inline

Returns whether this object has been initialized.

Returns
Returns true if some node's value has been assigned to this object, or false if this object doesn't yet represents any node.
template<typename... VariantT>
VariantNode<VariantT...>& jmespath::ast::VariantNode< VariantT >::operator= ( const VariantNode< VariantT > &  other)
inline

Assigns the other object's value to this object.

Parameters
[in]otherThe object whos value should be assigned to this object.
Returns
Returns a reference to this object.
template<typename... VariantT>
template<typename T >
VariantNode<VariantT...>& jmespath::ast::VariantNode< VariantT >::operator= ( const T &  other)
inline

Assigns the value of the other object to this object's internal variant making it the node that this object represents.

template<typename... VariantT>
bool jmespath::ast::VariantNode< VariantT >::operator== ( const VariantNode< VariantT > &  other) const
inline

Equality compares this node to the other.

Parameters
[in]otherThe node that should be compared.
Returns
Returns true if this object is equal to the other, otherwise false

Member Data Documentation

template<typename... VariantT>
ValueType jmespath::ast::VariantNode< VariantT >::value

The variable which stores the node that this object represents.


The documentation for this class was generated from the following file: