Untitled
By: a guest | Sep 9th, 2010 | Syntax:
C++ | Size: 0.85 KB | Hits: 67 | Expires: Never
#ifndef CONFIG_H
#define CONFIG_H
#include "Common.h"
#include <fstream>
#include <boost/regex.hpp>
class Config {
public:
Config(std::string ConfigFileName);
void ReloadConfig();
std::string GetStringDefault(std::string Name, std::string DefaultValue = "");
bool GetBoolDefault(std::string Name, bool DefaultValue = false);
int GetIntDefault(std::string Name, int DefaultValue = 0);
float GetFloatDefault(std::string Name, float DefaultValue = 0);
std::string GetFileName()
{
return this->configFileName;
}
~Config();
private:
std::string configFileName;
std::ifstream fileStream;
boost::regex searchPattern;
stringMapType configMap;
//--used for threading
boost::mutex lineBufferMutex;
boost::mutex configMapMutex;
std::list<std::string> lineBuffer;
bool isFileFinish;
void lineParser();
//--
};
#endif