Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion::base::SettingManager Class Reference

SettingManager tracks all existing SettingBase instances, and allows callers to obtain a map of all settings, get a specific setting or listen for when any setting in a group changes. More...

#include "settingmanager.h"

Public Types

typedef std::map< std::string,
SettingBase * > 
SettingMap
 Maps a setting's name to setting itself and its groups. More...
 

Public Member Functions

 ~SettingManager ()
 

Static Public Member Functions

static SettingBaseGetSetting (const std::string &name)
 Returns the setting with the passed name. More...
 
static const SettingMapGetAllSettings ()
 Returns all settings keyed by their names. More...
 
static void RegisterSetting (SettingBase *setting)
 Adds the setting to the manager and its groups. More...
 
static void UnregisterSetting (SettingBase *setting)
 Removes the setting from the manager and its groups. More...
 
static void RegisterGroupListener (const std::string &group, const std::string &key, const SettingBase::Listener &listener)
 Adds a function that will be called when any setting in the passed group changes. More...
 
static void EnableGroupListener (const std::string &group, const std::string &key, bool enable)
 Enables or disables the group listener identified by key. More...
 
static void UnregisterGroupListener (const std::string &group, const std::string &key)
 Removes the group listener identified by key. More...
 

Detailed Description

SettingManager tracks all existing SettingBase instances, and allows callers to obtain a map of all settings, get a specific setting or listen for when any setting in a group changes.

See SettingBase for a discussion of groups.

Definition at line 34 of file settingmanager.h.

Member Typedef Documentation

typedef std::map<std::string, SettingBase*> ion::base::SettingManager::SettingMap

Maps a setting's name to setting itself and its groups.

Definition at line 37 of file settingmanager.h.

Constructor & Destructor Documentation

ion::base::SettingManager::~SettingManager ( )

Definition at line 225 of file settingmanager.cc.

Member Function Documentation

void ion::base::SettingManager::EnableGroupListener ( const std::string &  group,
const std::string &  key,
bool  enable 
)
static

Enables or disables the group listener identified by key.

Definition at line 255 of file settingmanager.cc.

const SettingManager::SettingMap & ion::base::SettingManager::GetAllSettings ( )
static

Returns all settings keyed by their names.

Definition at line 232 of file settingmanager.cc.

SettingBase * ion::base::SettingManager::GetSetting ( const std::string &  name)
static

Returns the setting with the passed name.

Definition at line 228 of file settingmanager.cc.

void ion::base::SettingManager::RegisterGroupListener ( const std::string &  group,
const std::string &  key,
const SettingBase::Listener listener 
)
static

Adds a function that will be called when any setting in the passed group changes.

The listening function is identified by the passed key, which must be passed to UnregisterListener() to remove the listener. The particular setting that changed will be passed to the listener (see SettingBase::Listener).

Definition at line 248 of file settingmanager.cc.

void ion::base::SettingManager::RegisterSetting ( SettingBase setting)
static

Adds the setting to the manager and its groups.

Definition at line 236 of file settingmanager.cc.

Referenced by ion::base::SettingBase::SettingBase().

void ion::base::SettingManager::UnregisterGroupListener ( const std::string &  group,
const std::string &  key 
)
static

Removes the group listener identified by key.

Definition at line 261 of file settingmanager.cc.

void ion::base::SettingManager::UnregisterSetting ( SettingBase setting)
static

Removes the setting from the manager and its groups.

Definition at line 240 of file settingmanager.cc.

Referenced by ion::base::SettingBase::~SettingBase().


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