42 lines
1.0 KiB
C++
42 lines
1.0 KiB
C++
#ifndef BLUECORE_UTILITIES_CFGPARSER
|
|
#define BLUECORE_UTILITIES_CFGPARSER
|
|
|
|
#include <string>
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
namespace BlueCore {
|
|
|
|
class CfgParser
|
|
{
|
|
public:
|
|
void parseFile (const std::string& filename);
|
|
void parseLine (const std::string& line);
|
|
void parse (const char* buffer, unsigned int length);
|
|
|
|
double get (const std::string& key, double value = 0.0);
|
|
bool getDouble (const std::string& key, double& defaultValue);
|
|
|
|
int get (const std::string& key, int value = 0);
|
|
bool getInteger (const std::string& key, int& defaultValue);
|
|
|
|
bool get (const std::string& key, bool value = false);
|
|
bool getBoolean (const std::string& key, bool& defaultValue);
|
|
|
|
std::string get (const std::string& key, std::string value = "");
|
|
bool getString (const std::string& key, std::string& defaultValue);
|
|
|
|
bool getStrings (const std::string& key, std::vector<std::string>& strings);
|
|
|
|
bool getDoubles (const std::string& key, std::vector<double>& doubles);
|
|
|
|
private:
|
|
|
|
std::map<std::string, std::string> _Pairs;
|
|
};
|
|
|
|
} // namespace BlueCore
|
|
|
|
#endif
|
|
|