00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CONFIGURATION_DATABASE_H_
00019 #define CONFIGURATION_DATABASE_H_
00020
00021 #include <map>
00022 using std::map;
00023
00024 #include <vector>
00025 using std::vector;
00026
00027 #include <iterator>
00028 using std::iterator;
00029
00030 #include <iostream>
00031 using std::istream;
00032 using std::ostream;
00033
00034 #include <string>
00035 using std::string;
00036
00046 class ConfigurationDatabase
00047 {
00048 public:
00053 typedef map<string, string> KeyValuePair;
00058 typedef map<string, KeyValuePair> ConfigurationDatabaseType;
00060 typedef vector<string> Keys;
00062 typedef vector<string> Headers;
00063
00067 ConfigurationDatabase();
00073 ConfigurationDatabase(const string &filename);
00081 int intValue(const string &header, const string &key) const;
00089 double doubleValue(const string &header, const string &key) const;
00097 string stringValue(const string &header, const string &key) const;
00102 Headers headers() const;
00108 Keys keys(const string &header) const;
00115 void addHeaderKeyValuePair(const string &header, const string &key, const string &value);
00123 void addKeyValuePair(const string &header, const string &key, const string &value);
00134 friend istream& operator>>(istream &in, ConfigurationDatabase &database);
00143 friend ostream& operator<<(ostream &out, const ConfigurationDatabase &database);
00144
00145 private:
00147 ConfigurationDatabaseType m_configurations;
00153 map<int, string> m_comments;
00155 static const char BEGIN_COMMENT;
00157 static const char BEGIN_HEADER;
00159 static const char END_HEADER;
00160 };
00161 #endif