2011-08-28 15:17:58 +02:00
|
|
|
/*
|
2014-04-01 07:36:42 +02:00
|
|
|
* Copyright (c) 2010-2014 OTClient <https://github.com/edubart/otclient>
|
2011-08-28 15:17:58 +02:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2011-08-16 15:06:16 +02:00
|
|
|
#ifndef CONFIGMANAGER_H
|
|
|
|
#define CONFIGMANAGER_H
|
|
|
|
|
2014-03-31 18:43:31 +02:00
|
|
|
#include "config.h"
|
2011-08-16 15:06:16 +02:00
|
|
|
|
2012-06-22 05:14:13 +02:00
|
|
|
// @bindsingleton g_configs
|
2011-12-01 23:25:32 +01:00
|
|
|
class ConfigManager
|
2011-08-16 15:06:16 +02:00
|
|
|
{
|
|
|
|
public:
|
2014-04-01 13:30:17 +02:00
|
|
|
void init();
|
|
|
|
void terminate();
|
2012-06-22 05:14:13 +02:00
|
|
|
|
2014-03-31 18:43:31 +02:00
|
|
|
ConfigPtr getSettings();
|
|
|
|
ConfigPtr get(const std::string& file);
|
2011-08-16 15:06:16 +02:00
|
|
|
|
2014-04-01 14:54:13 +02:00
|
|
|
ConfigPtr create(const std::string& file);
|
2014-03-31 18:43:31 +02:00
|
|
|
ConfigPtr loadSettings(const std::string file);
|
|
|
|
ConfigPtr load(const std::string& file);
|
2014-04-01 15:34:12 +02:00
|
|
|
|
2014-03-31 18:43:31 +02:00
|
|
|
bool unload(const std::string& file);
|
2014-04-01 15:34:12 +02:00
|
|
|
void remove(const ConfigPtr config);
|
2012-02-02 00:37:40 +01:00
|
|
|
|
2014-03-31 18:43:31 +02:00
|
|
|
protected:
|
|
|
|
ConfigPtr m_settings;
|
2011-08-16 15:06:16 +02:00
|
|
|
|
|
|
|
private:
|
2014-03-31 18:43:31 +02:00
|
|
|
std::list<ConfigPtr> m_configs;
|
2011-08-16 15:06:16 +02:00
|
|
|
};
|
|
|
|
|
2011-12-01 23:25:32 +01:00
|
|
|
extern ConfigManager g_configs;
|
2011-08-16 15:06:16 +02:00
|
|
|
|
|
|
|
#endif
|