diff options
author | leak <leak@bitmx.net> | 2014-06-22 15:45:54 +0200 |
---|---|---|
committer | leak <leak@bitmx.net> | 2014-06-22 15:45:54 +0200 |
commit | ca3327dbed76d7d13b9e2754990b717267700be9 (patch) | |
tree | 51d194b4c2be37b7cd0ec0cd326cf907d5c76ef1 /src/server/shared/Configuration/Config.h | |
parent | 7dd6f0f1d8dcd14c8b9306553170f0023d30fc66 (diff) |
Replaced ACE_Configuration_Heap based config file handling with boost::property_tree::ini_parser
Diffstat (limited to 'src/server/shared/Configuration/Config.h')
-rw-r--r-- | src/server/shared/Configuration/Config.h | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/src/server/shared/Configuration/Config.h b/src/server/shared/Configuration/Config.h index 4693b21a0c7..d05a083d166 100644 --- a/src/server/shared/Configuration/Config.h +++ b/src/server/shared/Configuration/Config.h @@ -21,18 +21,11 @@ #include <string> #include <list> -#include <ace/Singleton.h> -#include <ace/Configuration_Import_Export.h> -#include <ace/Thread_Mutex.h> -#include <AutoPtr.h> - -typedef Trinity::AutoPtr<ACE_Configuration_Heap, ACE_Null_Mutex> Config; +#include <mutex> +#include <boost/property_tree/ptree.hpp> class ConfigMgr { - friend class ACE_Singleton<ConfigMgr, ACE_Null_Mutex>; - friend class ConfigLoader; - ConfigMgr() { } ~ConfigMgr() { } @@ -40,13 +33,11 @@ public: /// Method used only for loading main configuration files (authserver.conf and worldserver.conf) bool LoadInitial(char const* file); - /** - * This method loads additional configuration files - * It is recommended to use this method in WorldScript::OnConfigLoad hooks - * - * @return true if loading was successful - */ - bool LoadMore(char const* file); + static ConfigMgr* instance() + { + static ConfigMgr *instance = new ConfigMgr(); + return instance; + } bool Reload(); @@ -59,20 +50,14 @@ public: std::list<std::string> GetKeysByString(std::string const& name); private: - bool GetValueHelper(const char* name, ACE_TString &result); - bool LoadData(char const* file); - - typedef ACE_Thread_Mutex LockType; - typedef ACE_Guard<LockType> GuardType; - std::string _filename; - Config _config; - LockType _configLock; + boost::property_tree::ptree _config; + std::mutex _configLock; ConfigMgr(ConfigMgr const&); ConfigMgr& operator=(ConfigMgr const&); }; -#define sConfigMgr ACE_Singleton<ConfigMgr, ACE_Null_Mutex>::instance() +#define sConfigMgr ConfigMgr::instance() #endif |