/TGame/TUtil/Config/Properties.h

http://awoe.googlecode.com/ · C Header · 35 lines · 21 code · 8 blank · 6 comment · 0 complexity · ee5fb695d9fc0375d8458f6e42ec91da MD5 · raw file

  1. #ifndef ___PROPERTIES___HEADER___
  2. #define ___PROPERTIES___HEADER___
  3. #include "Entry/TExportUtil.h"
  4. namespace woe
  5. {
  6. //
  7. // a simple properties file parser
  8. //
  9. class TUTIL_API Properties
  10. {
  11. public:
  12. Properties(const string& file_name = "");
  13. bool init(const string& file_name);
  14. //
  15. //
  16. //
  17. bool parse(const string& key, short& value);
  18. bool parse(const string& key, int& value);
  19. bool parse(const string& key, bool& value);
  20. bool parse(const string& key, string& value);
  21. protected:
  22. bool add_line(const string& line);
  23. typedef std::map<string, string> Key2Value;
  24. Key2Value pairs_;
  25. };
  26. }
  27. #endif