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
multiselecthashnode.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Author: Róbert Márki <gsmiko@gmail.com>
4 ** Copyright (c) 2016 Róbert Márki
5 **
6 ** This file is part of the jmespath.cpp project which is distributed under
7 ** the MIT License (MIT).
8 **
9 ** Permission is hereby granted, free of charge, to any person obtaining a copy
10 ** of this software and associated documentation files (the "Software"), to
11 ** deal in the Software without restriction, including without limitation the
12 ** rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
13 ** sell copies of the Software, and to permit persons to whom the Software is
14 ** furnished to do so, subject to the following conditions:
15 **
16 ** The above copyright notice and this permission notice shall be included in
17 ** all copies or substantial portions of the Software.
18 **
19 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 ** FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 ** DEALINGS IN THE SOFTWARE.
26 **
27 ****************************************************************************/
28 #ifndef MULTISELECTHASHNODE_H
29 #define MULTISELECTHASHNODE_H
30 #include "src/ast/abstractnode.h"
31 #include "src/ast/identifiernode.h"
32 #include "src/ast/expressionnode.h"
33 #include <utility>
34 #include <initializer_list>
35 #include <boost/fusion/include/adapt_struct.hpp>
36 #include <boost/fusion/include/std_pair.hpp>
37 #include <boost/fusion/adapted/std_pair.hpp>
38 
39 namespace jmespath { namespace ast {
40 
46 {
47 public:
48  using KeyValuePairType = std::pair<IdentifierNode, ExpressionNode>;
58  MultiselectHashNode(const std::vector<KeyValuePairType>& subexpressions);
64  MultiselectHashNode(const std::initializer_list<KeyValuePairType>& subexpressions);
70  void accept(interpreter::AbstractVisitor* visitor) const override;
77  bool operator==(const MultiselectHashNode& other) const;
81  std::vector<KeyValuePairType> expressions;
82 };
83 }} // namespace jmespath::ast
84 
85 BOOST_FUSION_ADAPT_STRUCT(
87  (std::vector<jmespath::ast::MultiselectHashNode::KeyValuePairType>,
88  expressions)
89 )
90 #endif // MULTISELECTHASHNODE_H
std::vector< KeyValuePairType > expressions
The node's child expressions.
Definition: multiselecthashnode.h:81
MultiselectHashNode()
Constructs an empty MultiselectHashNode object.
Definition: multiselecthashnode.cpp:34
void accept(interpreter::AbstractVisitor *visitor) const override
Calls the visit method of the given visitor with the dynamic type of the node.
Definition: multiselecthashnode.cpp:53
The MultiselectHashNode class represents a JMESPath multiselect hash expression.
Definition: multiselecthashnode.h:45
bool operator==(const MultiselectHashNode &other) const
Equality compares this node to the other.
Definition: multiselecthashnode.cpp:58
The AbstractVisitor class is an interface which defines the member functions required to visit every ...
Definition: abstractvisitor.h:71
std::pair< IdentifierNode, ExpressionNode > KeyValuePairType
Definition: multiselecthashnode.h:48
The AbstractNode class is the common interface class for all AST node types.
Definition: abstractnode.h:45