4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
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
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.
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.
19 // The Original Code is Fraunhofer FOKUS code.
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.
26 // Stefan Bund <g0dil@berlios.de>
29 \brief ConfigFile public header */
31 #ifndef HH_SENF_Scheduler_Console_ConfigFile_
32 #define HH_SENF_Scheduler_Console_ConfigFile_ 1
37 //#include "ConfigFile.mpp"
38 #include "ConfigFile.ih"
39 //-/////////////////////////////////////////////////////////////////////////////////////////////////
44 /** \brief Console node tree based config file parser
46 A ConfigFile instance allows flexible parsing of a config file against the console node
47 tree. If you just want to parse a file completely, the senf::console::readConfig() function
48 will do that. ConfigFile however allows to incrementally parse only a subdirectory of the
49 complete configuration file.
51 senf::console::ConfigFile cf ("/my/config/file")
53 // Parse only statements under the directory of some object. The object 'ob'
54 // must have been registered somewhere in the node tree
57 // Parse rest of the config file
61 If your application uses multiple configuration sources, use a ConfigBundle and FileConfig
63 \ingroup console_access
66 : public detail::BundleMixin
69 //-////////////////////////////////////////////////////////////////////////
70 ///\name Structors and default members
73 explicit ConfigFile(std::string const & filename, DirectoryNode & root = senf::console::root());
74 ///< Create ConfigFile object for \a filename
75 /**< The \a filename configuration file will be parsed using
76 parse() calls. All configuration statements will be
77 interpreted relative to \a root as root node. */
80 //-////////////////////////////////////////////////////////////////////////
82 void ignoreMissing(); ///< Call to ignore missing files
85 detail::ConfigFileSource & self_;
88 /** \brief Read configuration file
90 The configuration file \a filename will be loaded, interpreting all node's relative to \a
93 This function uses a local ConfigFile object to perform the parsing.
97 void parseFile(std::string const & filename, DirectoryNode & root = senf::console::root());
99 /** \brief ConfigBundle source reading a configuration file
101 This constructor is used to create a config source parsing the given configuration file to
102 add to a ConfigBundle.
106 detail::ConfigFileSource::ptr FileConfig(std::string const & filename);
110 //-/////////////////////////////////////////////////////////////////////////////////////////////////
111 #include "ConfigFile.cci"
112 //#include "ConfigFile.ct"
113 //#include "ConfigFile.cti"
120 // comment-column: 40
121 // c-file-style: "senf"
122 // indent-tabs-mode: nil
123 // ispell-local-dictionary: "american"
124 // compile-command: "scons -u test"