bluecore/engine/Utilities/CfgParser.h

42 lines
1.0 KiB
C
Raw Permalink Normal View History

2008-01-16 12:45:17 +01:00
#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);
2008-01-20 11:16:37 +01:00
bool getDoubles (const std::string& key, std::vector<double>& doubles);
2008-01-16 12:45:17 +01:00
private:
std::map<std::string, std::string> _Pairs;
};
} // namespace BlueCore
#endif