00001 00006 #ifndef CONFIGURATION_H_ 00007 #define CONFIGURATION_H_ 00008 #include <iostream> 00009 #include <map> 00010 #include <vector> 00011 #include "Debug.h" 00012 00013 using namespace std; 00014 using namespace debug; 00015 00017 00021 class Configuration 00022 { 00023 public: 00031 Configuration(string cfile, Debug *dbg, vector<string> sections, vector<string> vars); 00033 virtual ~Configuration(); 00039 string GetValue(string key); 00044 string GetHostname(); 00046 void LoadSysVars(); 00047 protected: 00049 int content_len; 00051 char * content; 00053 map<string, string> config; 00055 map<string, string>::iterator config_it; 00062 void ReadFile (string cfile); 00064 void Parseconf(); 00070 void AddConf(string key, string value); 00078 bool CheckSyntax(string key, string value); 00079 private: 00081 char hostname[128]; 00083 Debug *dbg; 00085 string ipaddr; 00087 vector<string> sections; 00089 vector<string> vars; 00090 }; 00091 00092 #endif /*CONFIGURATION_H_*/