Files
CppNet/base/Config.h
2020-01-06 23:04:44 +08:00

33 lines
750 B
C++

#ifndef HEADER_BASE_CONFIG
#define HEADER_BASE_CONFIG
#include <map>
#include <mutex>
#include <string>
namespace base {
class CConfig {
public:
void SetFilePath(const std::string& path);
bool ReLoadFile();
bool LoadFile(const std::string& path);
int GetIntValue(const std::string& key);
std::string GetStringValue(const std::string& key);
double GetDoubleValue(const std::string& key);
bool GetBoolValue(const std::string& key);
private:
void _Trim(std::string& line);
private:
std::string _file;
std::mutex _mutex;
std::map<std::string, std::string> _config_map;
};
}
#endif