M_Global_Config.h 772 B

12345678910111213141516171819202122232425262728293031323334353637
  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. std::string mDesc;
  10. //数值
  11. int mIntValue;
  12. //数值列表
  13. std::vector<int> mIntListValue;
  14. //字符串
  15. std::string mStrValue;
  16. //字符串列表
  17. std::vector<std::string> mStrListValue;
  18. //布尔值参数
  19. bool mBoolValue;
  20. };
  21. class M_Global_Config
  22. {
  23. public:
  24. private:
  25. static std::auto_ptr<M_Global_Config> msSingleton;
  26. public:
  27. int GetCount();
  28. const M_Global_ConfigData* GetData(std::string Key);
  29. boost::unordered_map<std::string, M_Global_ConfigData>& GetMapData();
  30. void Reload();
  31. void Load(const std::string& path);
  32. void Load();
  33. static M_Global_Config* GetSingleton();
  34. private:
  35. boost::unordered_map<std::string, M_Global_ConfigData> mMapData;
  36. };