ManaPlus
|
#include <configuration.h>
Public Member Functions | |
virtual | ~ConfigurationObject () |
virtual void | setValue (const std::string &key, const std::string &value) |
void | deleteKey (const std::string &key) |
std::string | getValue (const std::string &key, const std::string &deflt) const |
int | getValue (const std::string &key, const int deflt) const |
int | getValueInt (const std::string &key, const int deflt) const |
bool | getValueBool (const std::string &key, const bool deflt) const |
unsigned | getValue (const std::string &key, const unsigned deflt) const |
double | getValue (const std::string &key, const double deflt) const |
void | clear () |
template<class IT , class T , class CONT > | |
void | setList (const std::string &name, IT begin, IT end, ConfigurationListManager< T, CONT > *manager) |
template<class T , class CONT > | |
CONT | getList (const std::string &name, CONT empty, ConfigurationListManager< T, CONT > *manager) |
Protected Types | |
typedef std::map< std::string, std::string > | Options |
typedef std::list< ConfigurationObject * > | ConfigurationList |
Protected Member Functions | |
ConfigurationObject () | |
virtual void | initFromXML (const xmlNode *const parentNode) |
virtual void | writeToXML (const xmlTextWriterPtr writer) |
void | deleteList (const std::string &name) |
Protected Attributes | |
Options | mOptions |
std::map< std::string, ConfigurationList > | mContainerOptions |
Friends | |
class | Configuration |
Configuration object, mapping values to names and possibly containing lists of further configuration objects
Definition at line 88 of file configuration.h.
|
protected |
Definition at line 220 of file configuration.h.
|
protected |
Definition at line 217 of file configuration.h.
|
virtual |
Definition at line 357 of file configuration.cpp.
References clear().
|
protected |
Definition at line 344 of file configuration.cpp.
Referenced by initFromXML(), and setList().
void ConfigurationObject::clear | ( | ) |
Re-sets all data in the configuration
Definition at line 332 of file configuration.cpp.
References deleteList(), mContainerOptions, and mOptions.
Referenced by Client::gameClear(), Configuration::init(), TestMain::initConfig(), initFromXML(), setList(), Configuration::unload(), and ~ConfigurationObject().
void ConfigurationObject::deleteKey | ( | const std::string & | key | ) |
Definition at line 234 of file configuration.cpp.
References mOptions.
Referenced by ConfigManager::checkConfigVersion(), Configuration::removeOldKeys(), ItemShortcut::save(), ShortcutBase::save(), OutfitWindow::save(), SpellManager::save(), MiniStatusWindow::saveBars(), WindowMenu::saveButtons(), ChatWindow::saveState(), and GraphicsManager::setVideoMode().
|
protected |
|
inline |
Serialises a container into a list of configuration options
name | Name of the list the elements should be read from under |
empty | Initial (empty) container to write to |
manager | An object capable of deserialising items into CONT |
Definition at line 182 of file configuration.h.
References empty, mContainerOptions, and ConfigurationListManager< T, CONT >::readConfigItem().
Referenced by PlayerRelationsManager::load().
double ConfigurationObject::getValue | ( | const std::string & | key, |
const double | deflt | ||
) | const |
Definition at line 312 of file configuration.cpp.
int ConfigurationObject::getValue | ( | const std::string & | key, |
const int | deflt | ||
) | const |
std::string ConfigurationObject::getValue | ( | const std::string & | key, |
const std::string & | deflt | ||
) | const |
Gets a value as string.
key | Option identifier. |
deflt | Default option if not there or error. |
Definition at line 269 of file configuration.cpp.
References GETLOG, and mOptions.
Referenced by Setup_Video::action(), UserPalette::addColor(), LocalPlayer::afkRespond(), Setup_Audio::apply(), Setup_Players::apply(), Setup_Theme::apply(), GameModifiers::changeAwayMode(), Game::changeMap(), Ea::ChatHandler::ChatHandler(), Desktop::Desktop(), GraphicsManager::detectVideoSettings(), GuildManager::init(), Dirs::initConfigDir(), ConfigManager::initConfiguration(), initDefaultWallpaperPaths(), Dirs::initLocalDataDir(), Dirs::initRootDir(), Dirs::initScreenshotDir(), Client::initSoundManager(), PlayerRelationsManager::load(), ItemShortcut::load(), ShortcutBase::load(), SetupItem::load(), OutfitWindow::load(), SpellManager::load(), MiniStatusWindow::loadBars(), WindowMenu::loadButtons(), ServerDialog::loadCustomServers(), UpdaterWindow::loadDirMods(), LocalPlayer::loadHomes(), Setup_Mods::loadMods(), UpdaterWindow::loadMods(), ChatWindow::loadState(), LoginDialog::LoginDialog(), SoundManager::playGuiSfx(), Gui::postInit(), InputManager::retrieve(), Game::saveScreenshot(), setDefaultOption(), WindowManager::setIcon(), Item::setId(), Client::stateConnectServer1(), UpdaterWindow::unloadMods(), and Gui::updateFonts().
unsigned ConfigurationObject::getValue | ( | const std::string & | key, |
const unsigned | deflt | ||
) | const |
Definition at line 303 of file configuration.cpp.
bool ConfigurationObject::getValueBool | ( | const std::string & | key, |
const bool | deflt | ||
) | const |
Definition at line 293 of file configuration.cpp.
References GETLOG, and mOptions.
Referenced by PacketLimiter::checkPackets(), PacketLimiter::limitPackets(), OutfitWindow::load(), Window::loadWindowState(), Minimap::Minimap(), MiniStatusWindow::MiniStatusWindow(), Joystick::open(), and StatusWindow::StatusWindow().
int ConfigurationObject::getValueInt | ( | const std::string & | key, |
const int | deflt | ||
) | const |
Definition at line 285 of file configuration.cpp.
References GETLOG, and mOptions.
Referenced by Setup_Video::action(), UserPalette::addColor(), GraphicsManager::detectVideoSettings(), Window::loadWindowState(), and GraphicsManager::setVideoMode().
|
protectedvirtual |
Definition at line 699 of file configuration.cpp.
References clear(), ConfigurationObject(), for_each_xml_child_node, XML::getProperty(), initFromXML(), mContainerOptions, and mOptions.
Referenced by Configuration::init(), initFromXML(), and Configuration::reInit().
|
inline |
Serialises a container into a list of configuration options
name | Name of the list the elements should be stored under |
begin | Iterator start |
end | Iterator end |
manager | An object capable of serialising T items |
Definition at line 146 of file configuration.h.
References clear(), ConfigurationObject(), deleteList(), mContainerOptions, and ConfigurationListManager< T, CONT >::writeConfigItem().
Referenced by PlayerRelationsManager::store().
|
virtual |
Sets an option using a string value.
key | Option identifier. |
value | Value. |
Reimplemented in Configuration.
Definition at line 228 of file configuration.cpp.
References mOptions.
Referenced by Configuration::setSilent(), and Configuration::setValue().
|
protectedvirtual |
Definition at line 813 of file configuration.cpp.
References FOR_EACH, Logger::log(), logger, mContainerOptions, and mOptions.
Referenced by Configuration::write().
|
friend |
Definition at line 90 of file configuration.h.
|
protected |
Definition at line 221 of file configuration.h.
Referenced by clear(), deleteList(), getList(), initFromXML(), setList(), and writeToXML().
|
protected |
Definition at line 218 of file configuration.h.
Referenced by clear(), deleteKey(), Configuration::getBoolValue(), Configuration::getFloatValue(), Configuration::getIntValue(), Configuration::getStringValue(), getValue(), getValueBool(), getValueInt(), Configuration::incValue(), initFromXML(), Configuration::removeOldKeys(), setValue(), and writeToXML().