Gaudi Framework, version v23r5

Home   Generated: Wed Nov 28 2012
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Node.h
Go to the documentation of this file.
1 // $Id:$
2 #ifndef JOBOPTIONSVC_NODE_H_
3 #define JOBOPTIONSVC_NODE_H_
4 // ============================================================================
5 // Includes:
6 // ============================================================================
7 // STD & STL:
8 // ============================================================================
9 #include <iostream>
10 #include <string>
11 #include <vector>
12 // ============================================================================
13 // BOOST:
14 // ============================================================================
15 
16 #include <boost/fusion/include/adapt_struct.hpp>
17 #include <boost/fusion/include/unused.hpp>
18 #include <boost/range/iterator_range.hpp>
19 // ============================================================================
20 #include "Position.h"
21 #include "Iterator.h"
22 // ============================================================================
23 namespace Gaudi { namespace Parsers {
24 // ============================================================================
25 class Node {
26 public:
36 
37  Node(): type(kRoot){}
38  std::string name() const;
39  std::string ToString() const;
40  std::string ToString(int indent) const;
41 };
42 // ============================================================================
44 public:
45  struct value {};
46  template<typename A, typename B = boost::fusion::unused_type,
47  typename C = boost::fusion::unused_type,
48  typename D = boost::fusion::unused_type>
49  struct result {
50  typedef void type;
51  };
52  //---------------------------------------------------------------------------
53  void operator()(Node& node, Node::NodeType type) const {
54  node.type = type;
55  }
56 
57  void operator()(Node& node, Node& child) const {
58  node.children.push_back(child);
59  }
60 
61  void operator()(Node& node, const std::string& val) const {
62  node.value = val;
63  }
64 
65  void operator()(Node& node, boost::iterator_range<Iterator> range) const {
66  node.value = boost::copy_range<std::string>(range);
67  }
68 
69  void operator()(Node& node, bool val) const {
70  node.value = val?"1":"0";
71  }
72 
73  void operator()(Node& node, const Iterator& iter) const {
74  const IteratorPosition& pos = iter.get_position();
75  node.position = Position(pos.file, pos.line, pos.column);
76  }
77 
78  //---------------------------------------------------------------------------
79 };
80 // ============================================================================
81 } /* Gaudi */ } /* Parsers */
82 // ============================================================================
83 BOOST_FUSION_ADAPT_STRUCT(
84  Gaudi::Parsers::Node,
85  (Gaudi::Parsers::Node::NodeType, type)
86  (std::string, value)
88 )
89 // ============================================================================
90 #endif // JOBOPTIONSVC_NODE_H_

Generated at Wed Nov 28 2012 12:17:12 for Gaudi Framework, version v23r5 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004