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