00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef INIPARSER_H
00020 #define INIPARSER_H
00021
00022 #include <string>
00023 #include <iostream>
00024 #include <fstream>
00025 #include <map>
00026
00027 class iniParser
00028 {
00029 private:
00030 typedef std::map<std::string, std::string> keys_t;
00031
00032 class emptyPair {};
00033
00034 private:
00035 std::map<std::string, keys_t> sections;
00036
00037 std::map<std::string, keys_t>::const_iterator curSection;
00038
00039 private:
00040 std::string parseSection(const char *buffer);
00041
00042 std::pair<std::string, std::string> parseKey(const char *buffer);
00043
00044 public:
00045 iniParser() {}
00046 ~iniParser() {}
00047
00048 bool open(const char *fName);
00049 void close();
00050
00051 bool setSection(const char *section);
00052 const char *getValue(const char *key);
00053 };
00054
00055 #endif // INIPARSER_H