Menu

[94f52a]: / parser / simple_node.hpp  Maximize  Restore  History

Download this file

53 lines (42 with data), 1.4 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef CHILON_PARSER_SIMPLE_NODE_HPP
#define CHILON_PARSER_SIMPLE_NODE_HPP
#include <chilon/parser/detail/simple_node.hpp>
#include <chilon/parser/object.hpp>
#include <chilon/parser/stored.hpp>
#include <chilon/parser/sequence.hpp>
#include <chilon/meta/return.hpp>
namespace chilon { namespace parser {
struct is_simple_node {};
template <class T, class... P>
struct simple_node : simple_node<T, sequence<P...>> {};
/**
* @brief Create a simple node that only stores a single value_ member.
* @tparam T Node type.
* @tparam P Parser used to construct value_ member.
*/
template <class T, class P>
struct simple_node<T, P>
: printable<detail::print_simple_node>,
hashable<detail::hash_simple_node>,
appendable<detail::append_simple_node>,
is_simple_node
{
typedef simple_node<T, P> node_type;
typedef typename detail::node_stored<P>::type value_type;
value_type value_;
typedef P node_parser_type;
bool operator==(node_type const& rhs) const {
return value_ == rhs.value_;
}
typedef typename detail::simple_node_parser<
meta::member<
node_type,
decltype(node_type::value_),
&simple_node<T, P>::value_ >,
P,
T
>::parser_type parser_type;
};
}
}
#endif
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.