replicode
inifile.h
Go to the documentation of this file.
1 #ifndef INIFILE_H
2 #define INIFILE_H
3 
4 #include <unordered_map>
5 #include <string>
6 
7 class IniFile
8 {
9 public:
10  bool readFile(std::string filename);
11 
12 
13  std::string getString(const std::string group, const std::string name, std::string defaultVal);
14  uint64_t getInt(const std::string group, const std::string name, uint64_t defaultVal);
15  double getDouble(const std::string group, const std::string name, double defaultVal);
16  int getBool(const std::string group, const std::string name, bool defaultVal);
17 
18 private:
19  bool hasInt(const std::string group, const std::string name);
20  bool hasDouble(const std::string group, const std::string name);
21  bool hasBool(const std::string group, const std::string name);
22  bool hasString(const std::string group, const std::string name);
23 
24  std::unordered_map<std::string, std::unordered_map<std::string, std::string>> m_values;
25 };
26 
27 
28 #endif // INIFILE_H
int getBool(const std::string group, const std::string name, bool defaultVal)
Definition: inifile.cpp:102
bool hasString(const std::string group, const std::string name)
Definition: inifile.cpp:109
bool hasInt(const std::string group, const std::string name)
Definition: inifile.cpp:134
double getDouble(const std::string group, const std::string name, double defaultVal)
Definition: inifile.cpp:96
uint64_t getInt(const std::string group, const std::string name, uint64_t defaultVal)
Definition: inifile.cpp:90
std::string getString(const std::string group, const std::string name, std::string defaultVal)
Definition: inifile.cpp:84
bool readFile(std::string filename)
Definition: inifile.cpp:33
std::unordered_map< std::string, std::unordered_map< std::string, std::string > > m_values
Definition: inifile.h:24
Definition: inifile.h:7
bool hasDouble(const std::string group, const std::string name)
Definition: inifile.cpp:115
bool hasBool(const std::string group, const std::string name)
Definition: inifile.cpp:127