summaryrefslogtreecommitdiff
path: root/support/highlight/src/core/configurationreader.h
blob: 7755081c12377f405a73f2516fd3fa5861e403d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/***************************************************************************
                          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 <http://www.gnu.org/licenses/>.
*/


#ifndef CONFIGURATIONREADER_H
#define CONFIGURATIONREADER_H

#include <string>
#include <map>
#include <vector>

using namespace std;

/** Maps parameter keys to values*/
typedef map<string, string> ParameterMap;


/** \brief Class to handle ASCII config files

  Configuration file format:<br>
  $ParamName=ParamValue<br>
  ParamValue may be splittet over multiple lines<br>
  ParamName is not case sensitive<br>
  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<string> &getParameterNames();

	private:
		ParameterMap parameterMap;
		bool fileFound;
		vector<string> parameterNames;
};

#endif