Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CSettingsBase Class Referenceabstract

Basic wrapper around CSettingsManager providing the framework for properly setting up the settings manager and registering all the callbacks, handlers and custom setting types. More...

#include <SettingsBase.h>

Inheritance diagram for CSettingsBase:
ADDON::CAddonSettings CSettings

Public Member Functions

virtual ~CSettingsBase ()
 
CSettingsManagerGetSettingsManager () const
 
virtual bool Initialize ()
 Initializes the setting system with the generic settings definition and platform specific setting definitions.
 
virtual bool IsInitialized () const
 Returns whether the settings system has been initialized or not.
 
virtual bool Load ()=0
 Loads the setting values.
 
virtual void SetLoaded ()
 Tells the settings system that all setting values have been loaded.
 
virtual bool IsLoaded () const
 Returns whether the settings system has been loaded or not.
 
virtual bool Save ()=0
 Saves the setting values.
 
virtual void Unload ()
 Unloads the previously loaded setting values.
 
virtual void Uninitialize ()
 Uninitializes the settings system.
 
void RegisterCallback (ISettingCallback *callback, const std::set< std::string > &settingList)
 Registers the given ISettingCallback implementation for the given set of settings.
 
void UnregisterCallback (ISettingCallback *callback)
 Unregisters the given ISettingCallback implementation.
 
std::shared_ptr< CSettingGetSetting (const std::string &id) const
 Gets the setting with the given identifier.
 
std::vector< std::shared_ptr< CSettingSection > > GetSections () const
 Gets the full list of setting sections.
 
std::shared_ptr< CSettingSectionGetSection (const std::string &section) const
 Gets the setting section with the given identifier.
 
bool GetBool (const std::string &id) const
 Gets the boolean value of the setting with the given identifier.
 
int GetInt (const std::string &id) const
 Gets the integer value of the setting with the given identifier.
 
double GetNumber (const std::string &id) const
 Gets the real number value of the setting with the given identifier.
 
std::string GetString (const std::string &id) const
 Gets the string value of the setting with the given identifier.
 
std::vector< CVariantGetList (const std::string &id) const
 Gets the values of the list setting with the given identifier.
 
bool SetBool (const std::string &id, bool value)
 Sets the boolean value of the setting with the given identifier.
 
bool ToggleBool (const std::string &id)
 Toggles the boolean value of the setting with the given identifier.
 
bool SetInt (const std::string &id, int value)
 Sets the integer value of the setting with the given identifier.
 
bool SetNumber (const std::string &id, double value)
 Sets the real number value of the setting with the given identifier.
 
bool SetString (const std::string &id, const std::string &value)
 Sets the string value of the setting with the given identifier.
 
bool SetList (const std::string &id, const std::vector< CVariant > &value)
 Sets the values of the list setting with the given identifier.
 
bool SetDefault (const std::string &id)
 Sets the value of the setting with the given identifier to its default.
 
void SetDefaults ()
 Sets the value of all settings to their default.
 

Protected Member Functions

 CSettingsBase ()
 
virtual void InitializeSettingTypes ()
 
virtual void InitializeControls ()
 
virtual void InitializeOptionFillers ()
 
virtual void UninitializeOptionFillers ()
 
virtual void InitializeConditions ()
 
virtual void UninitializeConditions ()
 
virtual bool InitializeDefinitions ()=0
 
virtual void InitializeVisibility ()
 
virtual void InitializeDefaults ()
 
virtual void InitializeISettingsHandlers ()
 
virtual void UninitializeISettingsHandlers ()
 
virtual void InitializeISubSettings ()
 
virtual void UninitializeISubSettings ()
 
virtual void InitializeISettingCallbacks ()
 
virtual void UninitializeISettingCallbacks ()
 
bool InitializeDefinitionsFromXml (const CXBMCTinyXML &xml)
 
bool LoadValuesFromXml (const CXBMCTinyXML &xml, bool &updated)
 Loads setting values from the given document in XML format.
 
bool SaveValuesToXml (CXBMCTinyXML &xml) const
 Saves the setting values in XML format to the given document.
 
bool LoadValuesFromXml (const TiXmlElement *root, bool &updated)
 Loads setting values from the given XML element.
 
bool LoadHiddenValuesFromXml (const TiXmlElement *root)
 Loads hidden setting values from the given XML element.
 

Protected Attributes

bool m_initialized = false
 
CSettingsManagerm_settingsManager
 
CCriticalSection m_critical
 

Detailed Description

Basic wrapper around CSettingsManager providing the framework for properly setting up the settings manager and registering all the callbacks, handlers and custom setting types.

See also
CSettingsManager

Constructor & Destructor Documentation

◆ ~CSettingsBase()

CSettingsBase::~CSettingsBase ( )
virtual

◆ CSettingsBase()

CSettingsBase::CSettingsBase ( )
protected

Member Function Documentation

◆ GetBool()

bool CSettingsBase::GetBool ( const std::string & id) const

Gets the boolean value of the setting with the given identifier.

Parameters
idSetting identifier
Returns
Boolean value of the setting with the given identifier

◆ GetInt()

int CSettingsBase::GetInt ( const std::string & id) const

Gets the integer value of the setting with the given identifier.

Parameters
idSetting identifier
Returns
Integer value of the setting with the given identifier

◆ GetList()

std::vector< CVariant > CSettingsBase::GetList ( const std::string & id) const

Gets the values of the list setting with the given identifier.

Parameters
idSetting identifier
Returns
List of values of the setting with the given identifier

◆ GetNumber()

double CSettingsBase::GetNumber ( const std::string & id) const

Gets the real number value of the setting with the given identifier.

Parameters
idSetting identifier
Returns
Real number value of the setting with the given identifier

◆ GetSection()

std::shared_ptr< CSettingSection > CSettingsBase::GetSection ( const std::string & section) const

Gets the setting section with the given identifier.

Parameters
sectionSetting section identifier
Returns
Setting section with the given identifier or NULL if the identifier is unknown

◆ GetSections()

std::vector< std::shared_ptr< CSettingSection > > CSettingsBase::GetSections ( ) const

Gets the full list of setting sections.

Returns
List of setting sections

◆ GetSetting()

SettingPtr CSettingsBase::GetSetting ( const std::string & id) const

Gets the setting with the given identifier.

Parameters
idSetting identifier
Returns
Setting object with the given identifier or NULL if the identifier is unknown

◆ GetSettingsManager()

CSettingsManager * CSettingsBase::GetSettingsManager ( ) const
inline

◆ GetString()

std::string CSettingsBase::GetString ( const std::string & id) const

Gets the string value of the setting with the given identifier.

Parameters
idSetting identifier
Returns
String value of the setting with the given identifier

◆ Initialize()

bool CSettingsBase::Initialize ( )
virtual

Initializes the setting system with the generic settings definition and platform specific setting definitions.

Returns
True if the initialization was successful, false otherwise

Reimplemented in ADDON::CAddonSettings, and CSettings.

◆ InitializeConditions()

virtual void CSettingsBase::InitializeConditions ( )
inlineprotectedvirtual

Reimplemented in ADDON::CAddonSettings, and CSettings.

◆ InitializeControls()

virtual void CSettingsBase::InitializeControls ( )
inlineprotectedvirtual

Reimplemented in ADDON::CAddonSettings, and CSettings.

◆ InitializeDefaults()

virtual void CSettingsBase::InitializeDefaults ( )
inlineprotectedvirtual

Reimplemented in CSettings.

◆ InitializeDefinitions()

virtual bool CSettingsBase::InitializeDefinitions ( )
protectedpure virtual

Implemented in ADDON::CAddonSettings, and CSettings.

◆ InitializeDefinitionsFromXml()

bool CSettingsBase::InitializeDefinitionsFromXml ( const CXBMCTinyXML & xml)
protected

◆ InitializeISettingCallbacks()

virtual void CSettingsBase::InitializeISettingCallbacks ( )
inlineprotectedvirtual

Reimplemented in CSettings.

◆ InitializeISettingsHandlers()

virtual void CSettingsBase::InitializeISettingsHandlers ( )
inlineprotectedvirtual

Reimplemented in CSettings.

◆ InitializeISubSettings()

virtual void CSettingsBase::InitializeISubSettings ( )
inlineprotectedvirtual

Reimplemented in CSettings.

◆ InitializeOptionFillers()

virtual void CSettingsBase::InitializeOptionFillers ( )
inlineprotectedvirtual

Reimplemented in CSettings.

◆ InitializeSettingTypes()

virtual void CSettingsBase::InitializeSettingTypes ( )
inlineprotectedvirtual

Reimplemented in ADDON::CAddonSettings, and CSettings.

◆ InitializeVisibility()

virtual void CSettingsBase::InitializeVisibility ( )
inlineprotectedvirtual

◆ IsInitialized()

bool CSettingsBase::IsInitialized ( ) const
virtual

Returns whether the settings system has been initialized or not.

◆ IsLoaded()

bool CSettingsBase::IsLoaded ( ) const
virtual

Returns whether the settings system has been loaded or not.

◆ Load()

virtual bool CSettingsBase::Load ( )
pure virtual

Loads the setting values.

Returns
True if the setting values are successfully loaded, false otherwise

Implemented in ADDON::CAddonSettings, and CSettings.

◆ LoadHiddenValuesFromXml()

bool CSettingsBase::LoadHiddenValuesFromXml ( const TiXmlElement * root)
protected

Loads hidden setting values from the given XML element.

Parameters
rootXML element containing setting values
Returns
True if the setting values were successfully loaded, false otherwise

◆ LoadValuesFromXml() [1/2]

bool CSettingsBase::LoadValuesFromXml ( const CXBMCTinyXML & xml,
bool & updated )
protected

Loads setting values from the given document in XML format.

Parameters
xmlDocument in XML format from which the settings are loaded
updatedOutput parameter indicating whether setting values had to be updated
Returns
True if the setting values were successfully loaded, false otherwise

◆ LoadValuesFromXml() [2/2]

bool CSettingsBase::LoadValuesFromXml ( const TiXmlElement * root,
bool & updated )
protected

Loads setting values from the given XML element.

Parameters
rootXML element containing setting values
updatedOutput parameter indicating whether setting values had to be updated
Returns
True if the setting values were successfully loaded, false otherwise

◆ RegisterCallback()

void CSettingsBase::RegisterCallback ( ISettingCallback * callback,
const std::set< std::string > & settingList )

Registers the given ISettingCallback implementation for the given set of settings.

Parameters
callbackISettingCallback implementation
settingListList of setting identifiers for which the given callback shall be triggered

◆ Save()

virtual bool CSettingsBase::Save ( )
pure virtual

Saves the setting values.

Returns
True if the setting values were successfully saved, false otherwise

Implemented in ADDON::CAddonSettings, and CSettings.

◆ SaveValuesToXml()

bool CSettingsBase::SaveValuesToXml ( CXBMCTinyXML & xml) const
protected

Saves the setting values in XML format to the given document.

Parameters
xmlDocument to save the setting values in XML format into
Returns
True if the setting values were successfully saved, false otherwise

◆ SetBool()

bool CSettingsBase::SetBool ( const std::string & id,
bool value )

Sets the boolean value of the setting with the given identifier.

Parameters
idSetting identifier
valueBoolean value to set
Returns
True if setting the value was successful, false otherwise

◆ SetDefault()

bool CSettingsBase::SetDefault ( const std::string & id)

Sets the value of the setting with the given identifier to its default.

Parameters
idSetting identifier
Returns
True if setting the value to its default was successful, false otherwise

◆ SetDefaults()

void CSettingsBase::SetDefaults ( )

Sets the value of all settings to their default.

◆ SetInt()

bool CSettingsBase::SetInt ( const std::string & id,
int value )

Sets the integer value of the setting with the given identifier.

Parameters
idSetting identifier
valueInteger value to set
Returns
True if setting the value was successful, false otherwise

◆ SetList()

bool CSettingsBase::SetList ( const std::string & id,
const std::vector< CVariant > & value )

Sets the values of the list setting with the given identifier.

Parameters
idSetting identifier
valueValues to set
Returns
True if setting the values was successful, false otherwise

◆ SetLoaded()

void CSettingsBase::SetLoaded ( )
virtual

Tells the settings system that all setting values have been loaded.

This manual trigger is necessary to enable the ISettingCallback methods being executed.

◆ SetNumber()

bool CSettingsBase::SetNumber ( const std::string & id,
double value )

Sets the real number value of the setting with the given identifier.

Parameters
idSetting identifier
valueReal number value to set
Returns
True if setting the value was successful, false otherwise

◆ SetString()

bool CSettingsBase::SetString ( const std::string & id,
const std::string & value )

Sets the string value of the setting with the given identifier.

Parameters
idSetting identifier
valueString value to set
Returns
True if setting the value was successful, false otherwise

◆ ToggleBool()

bool CSettingsBase::ToggleBool ( const std::string & id)

Toggles the boolean value of the setting with the given identifier.

Parameters
idSetting identifier
Returns
True if toggling the boolean value was successful, false otherwise

◆ Uninitialize()

void CSettingsBase::Uninitialize ( )
virtual

Uninitializes the settings system.

Unregisters all previously registered callbacks and destroys all setting objects.

◆ UninitializeConditions()

virtual void CSettingsBase::UninitializeConditions ( )
inlineprotectedvirtual

Reimplemented in CSettings.

◆ UninitializeISettingCallbacks()

virtual void CSettingsBase::UninitializeISettingCallbacks ( )
inlineprotectedvirtual

Reimplemented in CSettings.

◆ UninitializeISettingsHandlers()

virtual void CSettingsBase::UninitializeISettingsHandlers ( )
inlineprotectedvirtual

Reimplemented in CSettings.

◆ UninitializeISubSettings()

virtual void CSettingsBase::UninitializeISubSettings ( )
inlineprotectedvirtual

Reimplemented in CSettings.

◆ UninitializeOptionFillers()

virtual void CSettingsBase::UninitializeOptionFillers ( )
inlineprotectedvirtual

Reimplemented in CSettings.

◆ Unload()

void CSettingsBase::Unload ( )
virtual

Unloads the previously loaded setting values.

The values of all the settings are reset to their default values.

◆ UnregisterCallback()

void CSettingsBase::UnregisterCallback ( ISettingCallback * callback)

Unregisters the given ISettingCallback implementation.

Parameters
callbackISettingCallback implementation

Member Data Documentation

◆ m_critical

CCriticalSection CSettingsBase::m_critical
mutableprotected

◆ m_initialized

bool CSettingsBase::m_initialized = false
protected

◆ m_settingsManager

CSettingsManager* CSettingsBase::m_settingsManager
protected

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