-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigurationUtility.h
More file actions
44 lines (33 loc) · 1.19 KB
/
ConfigurationUtility.h
File metadata and controls
44 lines (33 loc) · 1.19 KB
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
#ifndef __CONFIGURATIONUTILITY_H__
#define __CONFIGURATIONUTILITY_H__
#include <string>
#include <vector>
using namespace std;
typedef vector<string> StringVector;
typedef vector<string>::iterator StringVectorIter;
//*******************************************************************
// Defines the exception class used to indicate an error has occured
// within the configuration service
class ConfigurationException
{
public:
ConfigurationException(const string& theMessage) : message(theMessage) {};
string message;
};
//*******************************************************************
// Abstract base class used to define some form of file-based configuration
// that would use a key-value lookup mechanism
class ConfigurationUtility
{
public:
ConfigurationUtility(void);
virtual ~ConfigurationUtility(void);
virtual string get(const string& key) throw (ConfigurationException) = 0;
virtual StringVector getKeys(void) = 0;
void loadFromFile(const string& fileName) throw (ConfigurationException);
bool initialized();
protected:
virtual void load(const string& fileName) throw (ConfigurationException) = 0;
bool m_initialized;
};
#endif