| Fling Engine 0.00.1 Fling Engine is a game engine written in Vulkan

FlingConfig.h
Go to the documentation of this file.
1 #pragma once
2
3 #include "Singleton.hpp"
4 #include "INIReader.h"
5
6 namespace Fling
7 {
12 class FlingConfig : public Singleton<FlingConfig>
13 {
14
15 public:
16
17 virtual void Init() override;
18
19 virtual void Shutdown() override;
20
28 bool LoadConfigFile(const std::string& t_File);
29
30 static std::string GetString(const std::string& t_Section, const std::string& t_Key) { return FlingConfig::Get().GetStringImpl(t_Section, t_Key); }
31
32 static int GetInt(const std::string& t_Section, const std::string& t_Key, const int t_DefaultVal = -1) { return FlingConfig::Get().GetIntImpl(t_Section, t_Key); }
33
34 static bool GetBool(const std::string& t_Section, const std::string& t_Key, const bool t_DefaultVal = false) { return FlingConfig::Get().GetBoolImpl(t_Section, t_Key); }
35
36 static float GetFloat(const std::string& t_Section, const std::string& t_Key, const float t_DefaultVal = 0.0f) { return FlingConfig::Get().GetFloatImpl(t_Section, t_Key); }
37
38 static double GetDouble(const std::string& t_Section, const std::string& t_Key, const double t_DefaultVal = 0.0) { return FlingConfig::Get().GetDoubleImpl(t_Section, t_Key); }
39
48 UINT32 LoadCommandLineOpts( int argc, char* argv[] );
49
50 private:
51
53 static INIReader m_IniReader;
54
55 std::string GetStringImpl(const std::string& t_Section, const std::string& t_Key) const;
56
57 int GetIntImpl(const std::string& t_Section, const std::string& t_Key, const int t_DefaultVal = -1) const;
58
59 bool GetBoolImpl(const std::string& t_Section, const std::string& t_Key, const bool t_DefaultVal = false) const;
60
61 float GetFloatImpl(const std::string& t_Section, const std::string& t_Key, const float t_DefaultVal = 0.0f) const;
62
63 double GetDoubleImpl(const std::string& t_Section, const std::string& t_Key, const double t_DefaultVal = 0.0) const;
64
65 };
66
67 } // namespace Fling
Fling::FlingConfig::GetBoolImpl
bool GetBoolImpl(const std::string &t_Section, const std::string &t_Key, const bool t_DefaultVal=false) const
Definition: FlingConfig.cpp:47
Fling::FlingConfig::GetString
static std::string GetString(const std::string &t_Section, const std::string &t_Key)
Definition: FlingConfig.h:30
Fling::FlingConfig::GetFloatImpl
float GetFloatImpl(const std::string &t_Section, const std::string &t_Key, const float t_DefaultVal=0.0f) const
Definition: FlingConfig.cpp:52
Fling::FlingConfig::GetStringImpl
std::string GetStringImpl(const std::string &t_Section, const std::string &t_Key) const
Definition: FlingConfig.cpp:37
Fling::FlingConfig::GetBool
static bool GetBool(const std::string &t_Section, const std::string &t_Key, const bool t_DefaultVal=false)
Definition: FlingConfig.h:34
Fling::Singleton
Class that can have only one instance.
Definition: Singleton.hpp:11
Fling::FlingConfig
Provide simple access to engine configuration options from an INI file #TODO Parse command line optio...
Definition: FlingConfig.h:12
Fling::FlingConfig::GetFloat
static float GetFloat(const std::string &t_Section, const std::string &t_Key, const float t_DefaultVal=0.0f)
Definition: FlingConfig.h:36
Fling::FlingConfig::Shutdown
virtual void Shutdown() override
Definition: FlingConfig.cpp:13
Fling::FlingConfig::m_IniReader
static INIReader m_IniReader
Ini config file reader.
Definition: FlingConfig.h:53
Fling::FlingConfig::GetDouble
static double GetDouble(const std::string &t_Section, const std::string &t_Key, const double t_DefaultVal=0.0)
Definition: FlingConfig.h:38
Fling::FlingConfig::GetInt
static int GetInt(const std::string &t_Section, const std::string &t_Key, const int t_DefaultVal=-1)
Definition: FlingConfig.h:32
Fling::FlingConfig::LoadConfigFile
bool LoadConfigFile(const std::string &t_File)
Attempt to load a config file (.ini) for the engine.
Definition: FlingConfig.cpp:21
Fling::FlingConfig::LoadCommandLineOpts
UINT32 LoadCommandLineOpts(int argc, char *argv[])
Load in the command line options and store them somewhere that is globally accessible.
Definition: FlingConfig.cpp:65
Fling::FlingConfig::Init
virtual void Init() override
Definition: FlingConfig.cpp:9
Fling::Singleton< FlingConfig >::Get
static FlingConfig & Get()
Definition: Singleton.hpp:36
Fling::FlingConfig::GetIntImpl
int GetIntImpl(const std::string &t_Section, const std::string &t_Key, const int t_DefaultVal=-1) const
Definition: FlingConfig.cpp:42
UINT32
uint32_t UINT32
Definition: FlingTypes.h:13
Fling
Definition: Engine.h:29
Fling::FlingConfig::GetDoubleImpl
double GetDoubleImpl(const std::string &t_Section, const std::string &t_Key, const double t_DefaultVal=0.0) const
Definition: FlingConfig.cpp:57
Singleton.hpp