M_Global_Config.h 744 B

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include <boost/unordered_map.hpp>
  3. #include <vector>
  4. struct M_Global_ConfigData
  5. {
  6. //Key
  7. std::string mKey;
  8. //数值
  9. int mIntValue;
  10. //数值列表
  11. std::vector<int> mIntListValue;
  12. //字符串
  13. std::string mStrValue;
  14. //字符串列表
  15. std::vector<std::string> mStrListValue;
  16. //布尔值参数
  17. bool mBoolValue;
  18. };
  19. class M_Global_Config
  20. {
  21. public:
  22. private:
  23. static std::auto_ptr<M_Global_Config> msSingleton;
  24. public:
  25. int GetCount();
  26. const M_Global_ConfigData* GetData(std::string Key);
  27. boost::unordered_map<std::string, M_Global_ConfigData>& GetMapData();
  28. void Reload();
  29. void Load(const std::string& path);
  30. void Load();
  31. static M_Global_Config* GetSingleton();
  32. private:
  33. boost::unordered_map<std::string, M_Global_ConfigData> mMapData;
  34. };