ConfigFileManager Class Reference

#include <ConfigFileManager.h>

List of all members.

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::istringlistKeys (Pentagram::istring section, bool longformat=false)
std::vector< Pentagram::istringlistSections (Pentagram::istring root, bool longformat=false)
std::map< Pentagram::istring,
std::string > 
listKeyValues (Pentagram::istring section, bool longformat=false)

Static Public Member Functions

static ConfigFileManagerget_instance ()

Private Member Functions

INIFilefindKeyINI (Pentagram::istring key)
INIFilefindWriteINI (Pentagram::istring key)

Private Attributes

std::vector< INIFile * > inifiles

Static Private Attributes

static ConfigFileManagerconfigfilemanager = 0


Detailed Description

Definition at line 28 of file ConfigFileManager.h.


Constructor & Destructor Documentation

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().


Member Function Documentation

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  ) 

does the key exist?

Referenced by SettingManager::listGames(), and GameData::translate().

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

Parameters:
section The section to return setkeys of
longformat If true, return the full key name, instead of just the last part
Returns:
the keys. They have no guaranteed order.

std::map<Pentagram::istring,std::string> ConfigFileManager::listKeyValues ( Pentagram::istring  section,
bool  longformat = false 
)

list all key-value pairs in the given section.

Parameters:
section The section to list
longformat If true, return the full key name (including section)
Returns:
the key-value pairs. They have no guaranteed order.

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

Parameters:
root The config root to list all sections in
longformat If true, return the full key name (including section)
Returns:
the sections. They have no guaranteed order.

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.

Parameters:
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)
Returns:
true if succesful

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

Parameters:
root The root to write, or empty string to write everything

Referenced by SettingManager::write().


Member Data Documentation

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]

Definition at line 105 of file ConfigFileManager.h.

Referenced by clear(), and clearRoot().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:28:50 2007 for pentagram by  doxygen 1.4.7