Config.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Utils_Console_Config_
18 #define HH_SENF_Utils_Console_Config_ 1
19 
20 // Custom includes
21 #include <list>
22 #include "Executor.hh"
23 
24 //#include "Config.mpp"
25 #include "Config.ih"
26 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 
28 namespace senf {
29 namespace console {
30 
53  {
54  public:
55  //-////////////////////////////////////////////////////////////////////////
57  //\{
58 
59  ConfigBundle();
61 
62  //\}
63  //-////////////////////////////////////////////////////////////////////////
64 
65  template <class Source>
66  Source & add(boost::intrusive_ptr<Source> source);
68 
69  void parse();
70 
71  void parse(DirectoryNode & restrict);
72 
75  bool complete() const;
76  bool parsed(GenericNode & node) const;
77  void reset();
78 
82  DirectoryNode & root() const;
83  void chroot(DirectoryNode & node);
84 
85  protected:
86 
87  private:
88  void parseInternal();
89 
90  typedef std::list<detail::ConfigSource::ptr> Sources;
91 
92  Sources sources_;
93  detail::RestrictedExecutor executor_;
94  };
95 
96 namespace detail {
97  // hrmpf ... Can't place this into Config.ih ...
98 
106  {
107  public:
108  BundleMixin();
110 
111  void parse();
112 
113  void parse(DirectoryNode & restrict);
114 
117  bool complete() const;
118  bool parsed(GenericNode & node) const;
119  void reset();
120 
124  protected:
125  template <class Source>
126  Source & add(boost::intrusive_ptr<Source> source);
127 
128  private:
129  ConfigBundle bundle_;
130  };
131 
132 }}}
133 
134 //-/////////////////////////////////////////////////////////////////////////////////////////////////
135 #include "Config.cci"
136 //#include "Config.ct"
137 #include "Config.cti"
138 #endif
139 
140 
141 // Local Variables:
142 // mode: c++
143 // fill-column: 100
144 // comment-column: 40
145 // c-file-style: "senf"
146 // indent-tabs-mode: nil
147 // ispell-local-dictionary: "american"
148 // compile-command: "scons -u test"
149 // End:
bool parsed(GenericNode &node) const
true. if node has been parsed
Config/console tree directory node.
Definition: Node.hh:406
Source & add(boost::intrusive_ptr< Source > source)
Add configuration source.
Definition: Config.hh:28
DirectoryNode & root() const
ConfigBundle()
root node is set to console::root()
void chroot(DirectoryNode &node)
void reset()
Reset node parse info state.
Internal: Provide ConfigBundle facade for a single-source config.
Definition: Config.hh:105
void parse()
Parse config bundle.
Definition: Config.cc:106
Config/console node tree base-class.
Definition: Node.hh:250
Executor public header.
Combine multiple configuration sources.
Definition: Config.hh:52
bool complete() const
true, if all nodes have been parsed