#include <ConfigFileManager.h>
Public Member Functions | |
ConfigFileManager () | |
~ConfigFileManager () | |
bool | readConfigFile (std::string fname, Pentagram::istring root, bool readonly=false) |
bool | readConfigString (std::string config, Pentagram::istring root, bool readonly=false) |
void | write (Pentagram::istring root=c_empty_string) |
void | clear () |
void | clearRoot (Pentagram::istring root) |
bool | exists (Pentagram::istring key) |
bool | get (Pentagram::istring key, std::string &ret) |
bool | get (Pentagram::istring key, int &ret) |
bool | get (Pentagram::istring, bool &ret) |
void | set (Pentagram::istring key, std::string value) |
void | set (Pentagram::istring key, const char *value) |
void | set (Pentagram::istring key, int value) |
void | set (Pentagram::istring key, bool value) |
void | unset (Pentagram::istring key) |
std::vector< Pentagram::istring > | listKeys (Pentagram::istring section, bool longformat=false) |
std::vector< Pentagram::istring > | listSections (Pentagram::istring root, bool longformat=false) |
std::map< Pentagram::istring, std::string > | listKeyValues (Pentagram::istring section, bool longformat=false) |
Static Public Member Functions | |
static ConfigFileManager * | get_instance () |
Private Member Functions | |
INIFile * | findKeyINI (Pentagram::istring key) |
INIFile * | findWriteINI (Pentagram::istring key) |
Private Attributes | |
std::vector< INIFile * > | inifiles |
Static Private Attributes | |
static ConfigFileManager * | configfilemanager = 0 |
Definition at line 28 of file ConfigFileManager.h.
ConfigFileManager::ConfigFileManager | ( | ) |
Definition at line 31 of file ConfigFileManager.cpp.
References con, configfilemanager, MM_INFO, and Console::Print().
ConfigFileManager::~ConfigFileManager | ( | ) |
Definition at line 39 of file ConfigFileManager.cpp.
References clear(), con, configfilemanager, MM_INFO, and Console::Print().
void ConfigFileManager::clear | ( | ) |
clear everything
Definition at line 89 of file ConfigFileManager.cpp.
References inifiles.
Referenced by ~ConfigFileManager().
void ConfigFileManager::clearRoot | ( | Pentagram::istring | root | ) |
clear everything in a root
Definition at line 99 of file ConfigFileManager.cpp.
References inifiles.
Referenced by CoreApp::killGame().
bool ConfigFileManager::exists | ( | Pentagram::istring | key | ) |
INIFile* ConfigFileManager::findKeyINI | ( | Pentagram::istring | key | ) | [private] |
INIFile* ConfigFileManager::findWriteINI | ( | Pentagram::istring | key | ) | [private] |
bool ConfigFileManager::get | ( | Pentagram::istring | , | |
bool & | ret | |||
) |
get value
bool ConfigFileManager::get | ( | Pentagram::istring | key, | |
int & | ret | |||
) |
get value
bool ConfigFileManager::get | ( | Pentagram::istring | key, | |
std::string & | ret | |||
) |
get value
Referenced by FixedWidthFont::Create(), CoreApp::getGameInfo(), TypeFlags::loadArmourInfo(), TypeFlags::loadMonsterInfo(), TypeFlags::loadWeaponInfo(), and GameData::translate().
static ConfigFileManager* ConfigFileManager::get_instance | ( | ) | [inline, static] |
Definition at line 34 of file ConfigFileManager.h.
References configfilemanager.
Referenced by FixedWidthFont::Create(), TypeFlags::loadArmourInfo(), HIDManager::loadBindings(), TreasureLoader::loadDefaults(), TypeFlags::loadMonsterInfo(), GameData::loadRemorseData(), GameData::loadTranslation(), GameData::loadU8Data(), TypeFlags::loadWeaponInfo(), FontShapeArchive::setHVLeads(), SettingManager::SettingManager(), GameData::setupJPOverrides(), GameData::setupTTFOverrides(), and GameData::translate().
std::vector<Pentagram::istring> ConfigFileManager::listKeys | ( | Pentagram::istring | section, | |
bool | longformat = false | |||
) |
list all keys in a section
section | The section to return setkeys of | |
longformat | If true, return the full key name, instead of just the last part |
std::map<Pentagram::istring,std::string> ConfigFileManager::listKeyValues | ( | Pentagram::istring | section, | |
bool | longformat = false | |||
) |
list all key-value pairs in the given section.
section | The section to list | |
longformat | If true, return the full key name (including section) |
Referenced by HIDManager::loadBindings(), TreasureLoader::loadDefaults(), FontShapeArchive::setHVLeads(), GameData::setupJPOverrides(), and GameData::setupTTFOverrides().
std::vector<Pentagram::istring> ConfigFileManager::listSections | ( | Pentagram::istring | root, | |
bool | longformat = false | |||
) |
list all sections
root | The config root to list all sections in | |
longformat | If true, return the full key name (including section) |
Referenced by SettingManager::listGames(), TypeFlags::loadArmourInfo(), TypeFlags::loadMonsterInfo(), and TypeFlags::loadWeaponInfo().
bool ConfigFileManager::readConfigFile | ( | std::string | fname, | |
Pentagram::istring | root, | |||
bool | readonly = false | |||
) |
read a config file. Multiple files may be read. Order is important.
fname | The file to read | |
root | The name of the root node in the file | |
readonly | If true, don't write to this file's tree (or the file) |
Referenced by GUIApp::LoadConsoleFont(), GameData::loadRemorseData(), GameData::loadTranslation(), GameData::loadU8Data(), SettingManager::readConfigFile(), and GUIApp::startupGame().
bool ConfigFileManager::readConfigString | ( | std::string | config, | |
Pentagram::istring | root, | |||
bool | readonly = false | |||
) |
Referenced by SettingManager::SettingManager().
void ConfigFileManager::set | ( | Pentagram::istring | key, | |
bool | value | |||
) |
set value
void ConfigFileManager::set | ( | Pentagram::istring | key, | |
int | value | |||
) |
set value
void ConfigFileManager::set | ( | Pentagram::istring | key, | |
const char * | value | |||
) |
set value
void ConfigFileManager::set | ( | Pentagram::istring | key, | |
std::string | value | |||
) |
set value
void ConfigFileManager::unset | ( | Pentagram::istring | key | ) |
remove key
void ConfigFileManager::write | ( | Pentagram::istring | root = c_empty_string |
) |
write all (writable) config files in the given root
root | The root to write, or empty string to write everything |
Referenced by SettingManager::write().
ConfigFileManager * ConfigFileManager::configfilemanager = 0 [static, private] |
Definition at line 107 of file ConfigFileManager.h.
Referenced by ConfigFileManager(), get_instance(), and ~ConfigFileManager().
std::vector<INIFile*> ConfigFileManager::inifiles [private] |