LRT14  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
Config.h
1 #ifndef RHESUS_CONFIG_H_
2 #define RHESUS_CONFIG_H_
3 
4 #include "../Defines.h"
5 
6 #include <map>
7 #include <hash_map>
8 #include <string>
9 
10 #ifdef RHESUS_NO_THROW
11 #include "../error_val.hpp"
12 #endif
13 
14 namespace Rhesus
15 {
16 namespace Toolkit
17 {
18 namespace Configuration
19 {
20 
25  class Config
26  {
27  public:
28  Config();
29 
34  void SetDefaultSection(std::string sectionId);
35 
41  template<typename T> T Get(std::string section, std::string key);
42 
47  template<typename T> T Get(std::string key);
48 
55  void Set(std::string section, std::string key, std::string value);
56 
62  void Set(std::string key, std::string value);
63 
68  void AddSection(std::string section);
69 
75  static Config Load(std::string filepath);
76 
77  private:
78 
79  typedef std::hash_map<std::string, std::string> strMap;
80  typedef std::hash_map<std::string, strMap> configMap;
81 
82  static std::string kDefaultSection;
83 
84  bool SectionExists(std::string section);
85  bool KeyExists(std::string section, std::string key);
86 
87  //hash_map<string, hash_map<string, string> > m_configMap;
88  configMap m_configMap;
89  std::string m_defaultSection;
90 
91  //ConfigLoader function
92  static std::string RemoveComments(std::string s);
93  };
94 
95 }
96 }
97 }
98 
99 #endif