Berserk
Public Member Functions | List of all members
Config Class Referencefinal

Key-values based config file in plist style. More...

#include <Config.hpp>

Public Member Functions

BRK_API Config ()
 
BRK_API ~Config ()
 
BRK_API bool Open (const String &filepath)
 Open config file path with specified path. More...
 
BRK_API int32 GetProperty (const StringName &section, const StringName &key, int32 defaultValue) const
 Read property int32 from the config. More...
 
BRK_API uint32 GetProperty (const StringName &section, const StringName &key, uint32 defaultValue) const
 Read property uint32 from the config. More...
 
BRK_API float GetProperty (const StringName &section, const StringName &key, float defaultValue) const
 Read property float from the config. More...
 
BRK_API String GetProperty (const StringName &section, const StringName &key, const String &defaultValue) const
 Read property string from the config. More...
 
BRK_API const StringGetFilepath () const
 
BRK_API bool IsOpen () const
 

Detailed Description

Key-values based config file in plist style.

Constructor & Destructor Documentation

◆ Config()

Config::Config ( )
default

◆ ~Config()

Config::~Config ( )
default

Member Function Documentation

◆ GetFilepath()

const String & Config::GetFilepath ( ) const
Returns
Open filepath of config

◆ GetProperty() [1/4]

String Config::GetProperty ( const StringName section,
const StringName key,
const String defaultValue 
) const

Read property string from the config.

Parameters
sectionSection name where to look for value
keyKey of the value
defaultValueDefault value returned if failed to get value from config
Returns
Value if found, otherwise defaultValue

◆ GetProperty() [2/4]

float Config::GetProperty ( const StringName section,
const StringName key,
float  defaultValue 
) const

Read property float from the config.

Parameters
sectionSection name where to look for value
keyKey of the value
defaultValueDefault value returned if failed to get value from config
Returns
Value if found, otherwise defaultValue

◆ GetProperty() [3/4]

int32 Config::GetProperty ( const StringName section,
const StringName key,
int32  defaultValue 
) const

Read property int32 from the config.

Parameters
sectionSection name where to look for value
keyKey of the value
defaultValueDefault value returned if failed to get value from config
Returns
Value if found, otherwise defaultValue

◆ GetProperty() [4/4]

uint32 Config::GetProperty ( const StringName section,
const StringName key,
uint32  defaultValue 
) const

Read property uint32 from the config.

Parameters
sectionSection name where to look for value
keyKey of the value
defaultValueDefault value returned if failed to get value from config
Returns
Value if found, otherwise defaultValue

◆ IsOpen()

BRK_API bool Config::IsOpen ( ) const
inline
Returns
True if file is open

◆ Open()

bool Config::Open ( const String filepath)

Open config file path with specified path.

Attempts to open config file specified in the filepath variable. Path can be absolute or relative, config will use default file system search paths to find config file on the disk.

Accepts config files in .config.xml format.

Parameters
filepathPath to the config file
Returns
True if successfully opened config file

The documentation for this class was generated from the following files: