ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

The (singleton) configuration manager, used to query & set configuration values using string keys. More...

#include <config-manager.h>

Inheritance diagram for Common::ConfigManager:
Collaboration diagram for Common::ConfigManager:

List of all members.

Classes

class  Domain

Public Types

typedef HashMap< String,
Domain, IgnoreCase_Hash,
IgnoreCase_EqualTo
DomainMap

Public Member Functions

void loadDefaultConfigFile ()
void loadConfigFile (const String &filename)
DomaingetDomain (const String &domName)
 Retrieve the config domain with the given name.
const DomaingetDomain (const String &domName) const
bool hasKey (const String &key) const
const Stringget (const String &key) const
void set (const String &key, const String &value)
void setAndFlush (const String &key, const Common::String &value)
 Update a configuration entry for the active domain and flush the configuration file to disk if the value changed.
bool hasKey (const String &key, const String &domName) const
const Stringget (const String &key, const String &domName) const
void set (const String &key, const String &value, const String &domName)
void removeKey (const String &key, const String &domName)
int getInt (const String &key, const String &domName=String()) const
bool getBool (const String &key, const String &domName=String()) const
void setInt (const String &key, int value, const String &domName=String())
void setBool (const String &key, bool value, const String &domName=String())
void registerDefault (const String &key, const String &value)
void registerDefault (const String &key, const char *value)
void registerDefault (const String &key, int value)
void registerDefault (const String &key, bool value)
void flushToDisk ()
void setActiveDomain (const String &domName)
DomaingetActiveDomain ()
const DomaingetActiveDomain () const
const StringgetActiveDomainName () const
void addGameDomain (const String &domName)
void removeGameDomain (const String &domName)
void renameGameDomain (const String &oldName, const String &newName)
void addMiscDomain (const String &domName)
void removeMiscDomain (const String &domName)
void renameMiscDomain (const String &oldName, const String &newName)
bool hasGameDomain (const String &domName) const
bool hasMiscDomain (const String &domName) const
const DomainMapgetGameDomains () const
DomainMap::iterator beginGameDomains ()
DomainMap::iterator endGameDomains ()
void copyFrom (ConfigManager &source)

Static Public Member Functions

static void defragment ()

Static Public Attributes

static char const *const kApplicationDomain = "residualvm"
 The name of the application domain (normally 'scummvm').
static char const *const kTransientDomain = "__TRANSIENT"
 The transient (pseudo) domain.
static char const *const kKeymapperDomain = "keymapper"
 The name of keymapper domain used to store the key maps.

Private Member Functions

 ConfigManager ()
void loadFromStream (SeekableReadStream &stream)
void addDomain (const String &domainName, const Domain &domain)
 Add a ready-made domain based on its name and contents The domain name should not already exist in the ConfigManager.
void writeDomain (WriteStream &stream, const String &name, const Domain &domain)
void renameDomain (const String &oldName, const String &newName, DomainMap &map)
 Common private function to rename both game and misc domains.

Private Attributes

Domain _transientDomain
DomainMap _gameDomains
DomainMap _miscDomains
Domain _appDomain
Domain _defaultsDomain
Domain _keymapperDomain
Array< String_domainSaveOrder
String _activeDomainName
Domain_activeDomain
String _filename

Friends

class Singleton< SingletonBaseType >

Detailed Description

The (singleton) configuration manager, used to query & set configuration values using string keys.

Todo:
Implement the callback based notification system (outlined below) which sends out notifications to interested parties whenever the value of some specific (or any) configuration key changes.

Definition at line 45 of file config-manager.h.


Member Typedef Documentation


Constructor & Destructor Documentation

Common::ConfigManager::ConfigManager (  )  [private]

Definition at line 53 of file config-manager.cpp.


Member Function Documentation

void Common::ConfigManager::addDomain ( const String domainName,
const Domain domain 
) [private]

Add a ready-made domain based on its name and contents The domain name should not already exist in the ConfigManager.

Definition at line 118 of file config-manager.cpp.

void Common::ConfigManager::addGameDomain ( const String domName  ) 

Definition at line 630 of file config-manager.cpp.

void Common::ConfigManager::addMiscDomain ( const String domName  ) 

Definition at line 644 of file config-manager.cpp.

DomainMap::iterator Common::ConfigManager::beginGameDomains (  )  [inline]

Definition at line 175 of file config-manager.h.

void Common::ConfigManager::copyFrom ( ConfigManager source  ) 

Definition at line 63 of file config-manager.cpp.

void Common::ConfigManager::defragment (  )  [static]

Definition at line 56 of file config-manager.cpp.

DomainMap::iterator Common::ConfigManager::endGameDomains (  )  [inline]

Definition at line 176 of file config-manager.h.

void Common::ConfigManager::flushToDisk (  ) 

Definition at line 251 of file config-manager.cpp.

const String & Common::ConfigManager::get ( const String key  )  const

Definition at line 453 of file config-manager.cpp.

const String & Common::ConfigManager::get ( const String key,
const String domName 
) const

Definition at line 464 of file config-manager.cpp.

Domain* Common::ConfigManager::getActiveDomain (  )  [inline]

Definition at line 159 of file config-manager.h.

const Domain* Common::ConfigManager::getActiveDomain (  )  const [inline]

Definition at line 160 of file config-manager.h.

const String& Common::ConfigManager::getActiveDomainName (  )  const [inline]

Definition at line 161 of file config-manager.h.

bool Common::ConfigManager::getBool ( const String key,
const String domName = String() 
) const

Definition at line 504 of file config-manager.cpp.

const ConfigManager::Domain * Common::ConfigManager::getDomain ( const String domName  )  const

Definition at line 358 of file config-manager.cpp.

ConfigManager::Domain * Common::ConfigManager::getDomain ( const String domName  ) 

Retrieve the config domain with the given name.

Parameters:
domName the name of the domain to retrieve
Returns:
pointer to the domain, or 0 if the domain doesn't exist.

Definition at line 380 of file config-manager.cpp.

const DomainMap& Common::ConfigManager::getGameDomains (  )  const [inline]

Definition at line 174 of file config-manager.h.

int Common::ConfigManager::getInt ( const String key,
const String domName = String() 
) const

Definition at line 483 of file config-manager.cpp.

bool Common::ConfigManager::hasGameDomain ( const String domName  )  const

Definition at line 702 of file config-manager.cpp.

bool Common::ConfigManager::hasKey ( const String key,
const String domName 
) const

Definition at line 425 of file config-manager.cpp.

bool Common::ConfigManager::hasKey ( const String key  )  const

Definition at line 406 of file config-manager.cpp.

bool Common::ConfigManager::hasMiscDomain ( const String domName  )  const

Definition at line 707 of file config-manager.cpp.

void Common::ConfigManager::loadConfigFile ( const String filename  ) 

Definition at line 101 of file config-manager.cpp.

void Common::ConfigManager::loadDefaultConfigFile (  ) 

Definition at line 80 of file config-manager.cpp.

void Common::ConfigManager::loadFromStream ( SeekableReadStream stream  )  [private]

Definition at line 153 of file config-manager.cpp.

void Common::ConfigManager::registerDefault ( const String key,
int  value 
)

Definition at line 608 of file config-manager.cpp.

void Common::ConfigManager::registerDefault ( const String key,
const String value 
)

Definition at line 600 of file config-manager.cpp.

void Common::ConfigManager::registerDefault ( const String key,
bool  value 
)

Definition at line 612 of file config-manager.cpp.

void Common::ConfigManager::registerDefault ( const String key,
const char *  value 
)

Definition at line 604 of file config-manager.cpp.

void Common::ConfigManager::removeGameDomain ( const String domName  ) 

Definition at line 651 of file config-manager.cpp.

void Common::ConfigManager::removeKey ( const String key,
const String domName 
)

Definition at line 439 of file config-manager.cpp.

void Common::ConfigManager::removeMiscDomain ( const String domName  ) 

Definition at line 661 of file config-manager.cpp.

void Common::ConfigManager::renameDomain ( const String oldName,
const String newName,
DomainMap map 
) [private]

Common private function to rename both game and misc domains.

Definition at line 683 of file config-manager.cpp.

void Common::ConfigManager::renameGameDomain ( const String oldName,
const String newName 
)

Definition at line 668 of file config-manager.cpp.

void Common::ConfigManager::renameMiscDomain ( const String oldName,
const String newName 
)

Definition at line 676 of file config-manager.cpp.

void Common::ConfigManager::set ( const String key,
const String value,
const String domName 
)

Definition at line 543 of file config-manager.cpp.

void Common::ConfigManager::set ( const String key,
const String value 
)

Definition at line 518 of file config-manager.cpp.

void Common::ConfigManager::setActiveDomain ( const String domName  ) 

Definition at line 620 of file config-manager.cpp.

void Common::ConfigManager::setAndFlush ( const String key,
const Common::String value 
)

Update a configuration entry for the active domain and flush the configuration file to disk if the value changed.

Definition at line 530 of file config-manager.cpp.

void Common::ConfigManager::setBool ( const String key,
bool  value,
const String domName = String() 
)

Definition at line 592 of file config-manager.cpp.

void Common::ConfigManager::setInt ( const String key,
int  value,
const String domName = String() 
)

Definition at line 588 of file config-manager.cpp.

void Common::ConfigManager::writeDomain ( WriteStream stream,
const String name,
const Domain domain 
) [private]

Definition at line 312 of file config-manager.cpp.


Friends And Related Function Documentation

friend class Singleton< SingletonBaseType > [friend]

Definition at line 182 of file config-manager.h.


Member Data Documentation

Definition at line 205 of file config-manager.h.

Definition at line 193 of file config-manager.h.

Definition at line 194 of file config-manager.h.

Definition at line 207 of file config-manager.h.

Definition at line 191 of file config-manager.h.

Definition at line 196 of file config-manager.h.

Definition at line 192 of file config-manager.h.

Definition at line 190 of file config-manager.h.

char const *const Common::ConfigManager::kApplicationDomain = "residualvm" [static]

The name of the application domain (normally 'scummvm').

Definition at line 87 of file config-manager.h.

char const *const Common::ConfigManager::kKeymapperDomain = "keymapper" [static]

The name of keymapper domain used to store the key maps.

Definition at line 93 of file config-manager.h.

char const *const Common::ConfigManager::kTransientDomain = "__TRANSIENT" [static]

The transient (pseudo) domain.

Definition at line 90 of file config-manager.h.


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


Generated on Sat Aug 8 2020 05:03:07 for ResidualVM by doxygen 1.7.1
curved edge   curved edge