forked from borzh/botrix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.h
51 lines (33 loc) · 1.7 KB
/
config.h
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
49
50
51
#ifndef __BOTRIX_CONFIG_H__
#define __BOTRIX_CONFIG_H__
#include "types.h"
#include "good/ini_file.h"
//****************************************************************************************************************
/// Class for storing configuration in ini file format.
//****************************************************************************************************************
class CConfiguration
{
public: // Methods.
/// Load configuration file. You need also provide game and mod folders in order to detect mod to use.
static TModId Load( const good::string& sFileName, const good::string& sGameDir, const good::string& sModDir );
/// Save configuration file (must be loaded first).
static void Save()
{
if ( m_bModified )
m_iniFile.save();
}
/// Unload configuration file, free all memory.
static void Unload() { m_iniFile.clear(); }
/// Get value for sKey of [General] section. Could be NULL.
static const good::string* GetGeneralSectionValue( const good::string& sKey );
/// Set value for sKey of [General] section.
static void SetGeneralSectionValue( const good::string& sKey, const good::string& sValue );
/// Get client access bits to execute commands on server (@see ). Section [User Access] is used.
static TCommandAccessFlags ClientAccessLevel( const good::string& sSteamId );
/// Set client access bits to execute commands on server (@see ).
static void SetClientAccessLevel( const good::string& sSteamId, TCommandAccessFlags iAccess );
protected: // Members.
static good::ini_file m_iniFile; // Ini file.
static bool m_bModified; // True if something was modified (to save later).
};
#endif // __BOTRIX_CONFIG_H__