00001 #ifndef CONF_H
00002 #define CONF_H
00003 #include <map>
00004 #include <list>
00005 #include <string>
00006 #include "engine/mutex.h"
00007 #include "conf_interface.h"
00008 #include "conf_impl.h"
00009
00010 class Config : public ConfigInterface
00011 {
00012 static ConfigImpl conf;
00013
00014 void Init();
00015 public:
00016 Config(std::string filename) { Init(); Load(filename); }
00017 Config() { Init(); }
00018
00019 void Load(std::string filename);
00020 void SetDefaultString(const std::string & name, const std::string & value) { conf.SetDefaultString(name, value); }
00021 void SetDefaultInt(const std::string & name, const int & value) { conf.SetDefaultInt(name, value); }
00022 void SetDefaultBool(const std::string & name, const bool & value) { conf.SetDefaultBool(name, value); }
00023
00024 bool Get( const std::string & name,
00025 std::string & value) { return conf.Get(name, value); }
00026 bool Get( const std::string & name,
00027 int & value) { return conf.Get(name, value); }
00028 bool Get( const std::string & name,
00029 bool & value) { return conf.Get(name, value); }
00030 bool Get( const std::string & name,
00031 std::list<std::string> & value) { return conf.Get(name, value); }
00032 bool Get( const std::string & name,
00033 std::list<int> & value) { return conf.Get(name, value); }
00034
00035 void SetString(std::string name, const std::string & value) { conf.SetString(name, value); }
00036 void SetInt(std::string name, const int & value) { conf.SetInt(name, value); }
00037 void SetBool(std::string name, const bool & value) { conf.SetBool(name, value); }
00038 void SetStringList(std::string name, const std::list<std::string> & value) { conf.SetStringList(name, value); }
00039 void SetIntList(std::string name, const std::list<int> & value) { conf.SetIntList(name, value); }
00040
00041
00042 std::string GetAsString() { return conf.GetAsString(); }
00043 void Parse(std::string line) { conf.Parse(line); }
00044 void ParseShellArgs(int argc, char** argv) { conf.ParseShellArgs(argc, argv); }
00045 bool IsLoaded() { return conf.IsLoaded(); }
00046 void LoadFromStandardPath(std::string filename);
00047 void ReloadLog();
00048 };
00049
00050 #endif