/*************************************************************************** configurationreader.h - description ------------------- begin : Son Nov 10 2002 copyright : (C) 2002 by Andre Simon email : andre.simon1@gmx.de ***************************************************************************/ /* This file is part of Highlight. Highlight is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Highlight is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Highlight. If not, see . */ #ifndef CONFIGURATIONREADER_H #define CONFIGURATIONREADER_H #include #include #include using namespace std; /** Maps parameter keys to values*/ typedef map ParameterMap; /** \brief Class to handle ASCII config files Configuration file format:
$ParamName=ParamValue
ParamValue may be splittet over multiple lines
ParamName is not case sensitive
Comments start with # as the first character of a line **/ class ConfigurationReader { public: /** Constructor \param configuration_path Path to configuration file */ ConfigurationReader ( const string & configuration_path ); ~ConfigurationReader(); /** \param paramName Name of parameter \return Value of parameter */ string &getParameter ( const string & paramName ); /** \param paramName Name of parameter \return Value of parameter */ const char* getCParameter ( const string & paramName ); /** \return True if config file exists */ bool found(); /** \return List of parameter names */ vector &getParameterNames(); private: ParameterMap parameterMap; bool fileFound; vector parameterNames; }; #endif