-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIniFile.h
More file actions
49 lines (36 loc) · 1.36 KB
/
IniFile.h
File metadata and controls
49 lines (36 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
Copyright (c) 2024-2025 Toksisitee. All rights reserved.
This work is licensed under the terms of the MIT license.
For a copy, refer to license.md or https://opensource.org/licenses/MIT
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.
*/
#pragma once
#include <string>
#include <unordered_map>
enum class EIniSetting : uint8_t
{
ExportDirectory,
PopulousDirectory,
};
class CIniFile
{
public:
explicit CIniFile( const std::string& sConfigName );
void Initialize();
std::string GetString( EIniSetting eSetting, const std::string& sDefault = "" );
void SetString( EIniSetting eSetting, const std::string& sValue );
int GetInt( EIniSetting eSetting, int nDefault = 0 );
void SetInt( EIniSetting eSetting, int nValue );
bool GetBool( EIniSetting eSetting, bool bDefault = false );
void SetBool( EIniSetting eSetting, bool bValue );
float GetFloat( EIniSetting eSetting, float fDefault = 0.0f );
void SetFloat( EIniSetting eSetting, float fValue );
void ResetSection();
private:
std::string m_sFilePath;
static const std::string m_sSection;
static const std::unordered_map<EIniSetting, std::string> m_mapSettingKeys;
std::string GetKey( EIniSetting eSetting );
};