bluecore/engine/Utilities/CfgParser.h

40 lines
987 B
C
Raw Normal View History

2008-01-16 11:45:17 +00: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);
private:
std::map<std::string, std::string> _Pairs;
};
} // namespace BlueCore
#endif