OregonCore  revision fb2a440-git
Your Favourite TBC server
Config.h
Go to the documentation of this file.
1 /*
2  * This file is part of the OregonCore Project. See AUTHORS file for Copyright information
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef CONFIG_H
19 #define CONFIG_H
20 
21 #include "Common.h"
22 #include <Policies/Singleton.h>
23 #include "Platform/Define.h"
24 
25 class ACE_Configuration_Heap;
26 
27 class Config
28 {
29  public:
30  Config();
31  ~Config();
32 
33  bool SetSource(const char* file);
34  bool Reload();
35 
36  std::string GetStringDefault(const char* name, const char* def);
37  bool GetBoolDefault(const char* name, const bool def = false);
38  int32 GetIntDefault(const char* name, const int32 def);
39  float GetFloatDefault(const char* name, const float def);
40 
41  std::string GetFilename() const
42  {
43  return mFilename;
44  }
45 
46  private:
47 
48  std::string mFilename;
49  ACE_Configuration_Heap* mConf;
50 };
51 
52 #define sConfig Oregon::Singleton<Config>::Instance()
53 
54 #endif
55 
bool Reload()
Definition: Config.cpp:65
std::string GetFilename() const
Definition: Config.h:41
std::string mFilename
Definition: Config.h:48
ACE_INT32 int32
Definition: Define.h:67
int32 GetIntDefault(const char *name, const int32 def)
Definition: Config.cpp:103
Definition: Config.h:27
float GetFloatDefault(const char *name, const float def)
Definition: Config.cpp:110
ACE_Configuration_Heap * mConf
Definition: Config.h:49
~Config()
Definition: Config.cpp:54
bool GetBoolDefault(const char *name, const bool def=false)
Definition: Config.cpp:88
bool SetSource(const char *file)
Definition: Config.cpp:59
Config()
Definition: Config.cpp:49
std::string GetStringDefault(const char *name, const char *def)
Definition: Config.cpp:82