linux版本中间件

Config.h 887B

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include <iostream>
  3. #include <string>
  4. #include <json/json.h>
  5. #include <fstream>
  6. #define CFGPATH "cfg.json"
  7. class CConfig
  8. {
  9. public:
  10. CConfig();
  11. ~CConfig();
  12. bool load();
  13. bool write();
  14. std::string fsAddr();
  15. short int fsPort();
  16. std::string fsPwd();
  17. uint16_t wsPort();
  18. std::string dbAddr();
  19. std::string dbUser();
  20. std::string dbPwd();
  21. std::string dbDatabase();
  22. int trunkCount(); // 中继数量
  23. std::string extContext();
  24. std::string meetingContext();
  25. std::string ttsPath(); //tts路径
  26. std::string recordPath(); // 录音路径
  27. std::string gateWayPrefix(); // 出局字冠
  28. std::string gateWayCaller(); // 网关号码/底号
  29. std::string gateWayAccount(); // 网关名字
  30. bool isAutoRecord(); // 是否自动录音
  31. static CConfig* GetInstance() { return &cfg; }
  32. private:
  33. static CConfig cfg;
  34. Json::Value root;
  35. };