| 6 |
| 7 | #ifndef TGVOIP_VOIPSERVERCONFIG_H |
| 8 | #define TGVOIP_VOIPSERVERCONFIG_H |
| 9 |
| 10 | #include <map> |
| 11 | #include <string> |
| 12 | #include <stdint.h> |
| 13 | #include "threading.h" |
| 14 | #include "json11.hpp" |
| 15 |
| 16 | namespace tgvoip{ |
| 17 |
| 18 | class ServerConfig{ |
| 19 | public: |
| 20 | ServerConfig(); |
| 21 | ~ServerConfig(); |
| 22 | static ServerConfig* GetSharedInstance(); |
| 23 | int32_t GetInt(std::string name, int32_t fallback); |
| 24 | double GetDouble(std::string name, double fallback); |
| 25 | std::string GetString(std::string name, std::string fallback); |
| 26 | bool GetBoolean(std::string name, bool fallback); |
| 27 | void Update(std::string jsonString); |
| 28 |
| 29 | private: |
| 30 | static ServerConfig* sharedInstance; |
| 31 | bool ContainsKey(std::string key); |
| 32 | json11::Json config; |
| 33 | Mutex mutex; |
| 34 | }; |
| 35 | } |
| 36 |
| 37 | #endif //TGVOIP_VOIPSERVERCONFIG_H |
| 38 |