switch to new MPL based Fraunhofer FOKUS Public License
[senf.git] / senf / Utils / Console / Config.cci
1 // $Id$
2 //
3 // Copyright (C) 2008
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 //
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at 
9 // http://senf.berlios.de/license.html
10 //
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on, 
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
14 //
15 // Software distributed under the License is distributed on an "AS IS" basis, 
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
17 // for the specific language governing rights and limitations under the License.
18 //
19 // The Original Code is Fraunhofer FOKUS code.
20 //
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. 
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
24 //
25 // Contributor(s):
26 //   Stefan Bund <g0dil@berlios.de>
27
28 /** \file
29     \brief Config inline non-template implementation */
30
31 #include "Config.ih"
32
33 // Custom includes
34
35 #define prefix_ inline
36 //-/////////////////////////////////////////////////////////////////////////////////////////////////
37
38 //-/////////////////////////////////////////////////////////////////////////////////////////////////
39 // senf::console::detail::RestrictedExecutor
40
41 prefix_ bool senf::console::detail::RestrictedExecutor::complete()
42     const
43 {
44     return parsedNodes_.size() == 1
45         && ! parsedNodes_[0].expired()
46         && *parsedNodes_[0].lock() == executor_.chroot();
47 }
48
49 prefix_ void senf::console::detail::RestrictedExecutor::reset()
50 {
51     parsedNodes_.clear();
52 }
53
54 prefix_ senf::console::DirectoryNode & senf::console::detail::RestrictedExecutor::root()
55     const
56 {
57     return executor_.chroot();
58 }
59
60 prefix_ void senf::console::detail::RestrictedExecutor::chroot(DirectoryNode & node)
61 {
62     executor_.chroot(node);
63 }
64
65 prefix_ std::ostream & senf::console::detail::RestrictedExecutor::stream()
66 {
67     return stream_;
68 }
69
70 //-/////////////////////////////////////////////////////////////////////////////////////////////////
71 // senf::console::ConfigBundle
72
73 prefix_ senf::console::ConfigBundle::ConfigBundle()
74 {}
75
76 prefix_ senf::console::ConfigBundle::ConfigBundle(DirectoryNode & root)
77     : executor_ (root)
78 {}
79
80 prefix_ bool senf::console::ConfigBundle::complete()
81     const
82 {
83     return executor_.complete();
84 }
85
86 prefix_ bool senf::console::ConfigBundle::parsed(GenericNode & node)
87     const
88 {
89     return executor_.parsed(node);
90 }
91
92 prefix_ void senf::console::ConfigBundle::reset()
93 {
94     executor_.reset();
95 }
96
97 prefix_ senf::console::DirectoryNode & senf::console::ConfigBundle::root()
98     const
99 {
100     return executor_.root();
101 }
102
103 prefix_ void senf::console::ConfigBundle::chroot(DirectoryNode & node)
104 {
105     executor_.chroot(node);
106 }
107
108 //-/////////////////////////////////////////////////////////////////////////////////////////////////
109 // senf::console::detail::ConfigSource
110
111 prefix_ void senf::console::detail::ConfigSource::parse(RestrictedExecutor & executor)
112 {
113     v_parse(executor);
114 }
115
116 //-/////////////////////////////////////////////////////////////////////////////////////////////////
117 // senf::console::detail::BundleMixin
118
119 prefix_ senf::console::detail::BundleMixin::BundleMixin()
120 {}
121
122 prefix_ senf::console::detail::BundleMixin::BundleMixin(DirectoryNode & root)
123     : bundle_ (root)
124 {}
125
126 prefix_ void senf::console::detail::BundleMixin::parse()
127 {
128     bundle_.parse();
129 }
130
131 prefix_ void senf::console::detail::BundleMixin::parse(DirectoryNode & restrict)
132 {
133     bundle_.parse(restrict);
134 }
135
136 prefix_ bool senf::console::detail::BundleMixin::complete()
137     const
138 {
139     return bundle_.complete();
140 }
141
142 prefix_ bool senf::console::detail::BundleMixin::parsed(GenericNode & node)
143     const
144 {
145     return bundle_.parsed(node);
146 }
147
148 prefix_ void senf::console::detail::BundleMixin::reset()
149 {
150     bundle_.reset();
151 }
152
153 //-/////////////////////////////////////////////////////////////////////////////////////////////////
154 #undef prefix_
155
156 \f
157 // Local Variables:
158 // mode: c++
159 // fill-column: 100
160 // comment-column: 40
161 // c-file-style: "senf"
162 // indent-tabs-mode: nil
163 // ispell-local-dictionary: "american"
164 // compile-command: "scons -u test"
165 // End: