ConfigParser.h 769 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef __CONFIG_PARSER__
  2. #define __CONFIG_PARSER__
  3. #include <map>
  4. #include <string>
  5. #include <vector>
  6. namespace XEngine
  7. {
  8. using namespace std;
  9. class CConfigParser
  10. {
  11. public:
  12. CConfigParser();
  13. ~CConfigParser();
  14. public:
  15. bool Parser(const string & cFilePath);
  16. bool HasSection(const string & cSection);
  17. int GetSections(vector<string> & vecSections);
  18. int GetKeys(const string & strSection, vector<string> & vec);
  19. const map<string, string> * GetSectionConfig(const string & cSection);
  20. string GetConfig(const string & cSection, const string & cKey);
  21. string GetDefConfig(const string & cSection, const string & cKey, const string & cDef);
  22. private:
  23. map<string, map<string, string> *> m_mpConfigData;
  24. };
  25. }
  26. #endif //__CONFIG_PARSER__