/* * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license: http://github.com/azerothcore/azerothcore-wotlk/LICENSE-GPL2 * Copyright (C) 2008-2016 TrinityCore * Copyright (C) 2005-2009 MaNGOS */ #ifndef CONFIG_H #define CONFIG_H #include #include #include #include #include #include #include typedef Trinity::AutoPtr Config; class ConfigMgr { friend class ACE_Singleton; friend class ConfigLoader; ConfigMgr() { } ~ConfigMgr() { } 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); bool Reload(); std::string GetStringDefault(const char* name, const std::string& def); bool GetBoolDefault(const char* name, bool def); int GetIntDefault(const char* name, int def); float GetFloatDefault(const char* name, float def); std::list 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 GuardType; std::vector _confFiles; Config _config; LockType _configLock; ConfigMgr(ConfigMgr const&); ConfigMgr& operator=(ConfigMgr const&); }; #define sConfigMgr ACE_Singleton::instance() #endif