Setting value handler
Inside addon main instance used helper class to give settings value.
More...
Setting value handler
Inside addon main instance used helper class to give settings value.
This is used on addon::CAddonBase::SetSetting() to inform addon about settings change by used. This becomes then used to give the related value name.
The following table contains values that can be set with class CSettingValue :
Name | Type | Get call |
Settings value as string | std::string | GetString |
Settings value as integer | int | GetInt |
Settings value as unsigned integer | unsigned int | GetUInt |
Settings value as boolean | bool | GetBoolean |
Settings value as floating point | float | GetFloat |
Settings value as enum | enum | GetEnum |
Here is a code example how this is used:
enum myEnumValue
{
valueA,
valueB,
valueC
};
std::string m_myStringValue;
int m_myIntegerValue;
bool m_myBooleanValue;
float m_myFloatingPointValue;
myEnumValue m_myEnumValue;
{
if (settingName == "my_string_value")
else if (settingName == "my_integer_value")
m_myIntegerValue = settingValue.
GetInt();
else if (settingName == "my_boolean_value")
else if (settingName == "my_float_value")
m_myFloatingPointValue = settingValue.
GetFloat();
else if (settingName == "my_enum_value")
m_myEnumValue = settingValue.
GetEnum<myEnumValue>();
}
Definition kodi-dev-kit/include/kodi/AddonBase.h:431
ADDON_STATUS
Definition addon_base.h:138
const std::string & GetString() const
To get settings value as string.
Definition kodi-dev-kit/include/kodi/AddonBase.h:454
bool GetBoolean() const
To get settings value as boolean.
Definition kodi-dev-kit/include/kodi/AddonBase.h:463
float GetFloat() const
To get settings value as floating point.
Definition kodi-dev-kit/include/kodi/AddonBase.h:466
enumType GetEnum() const
To get settings value as enum.
Definition kodi-dev-kit/include/kodi/AddonBase.h:471
int GetInt() const
To get settings value as integer.
Definition kodi-dev-kit/include/kodi/AddonBase.h:457
- Note
- The asked type should match the type used on settings.xml.
◆ GetBoolean()
bool kodi::addon::CSettingValue::GetBoolean |
( |
| ) |
const |
|
inline |
To get settings value as boolean.
◆ GetEnum()
template<typename enumType >
enumType kodi::addon::CSettingValue::GetEnum |
( |
| ) |
const |
|
inline |
To get settings value as enum.
- Note
- Inside settings.xml them stored as integer.
◆ GetFloat()
float kodi::addon::CSettingValue::GetFloat |
( |
| ) |
const |
|
inline |
To get settings value as floating point.
◆ GetInt()
int kodi::addon::CSettingValue::GetInt |
( |
| ) |
const |
|
inline |
To get settings value as integer.
◆ GetString()
const std::string & kodi::addon::CSettingValue::GetString |
( |
| ) |
const |
|
inline |
To get settings value as string.
◆ GetUInt()
unsigned int kodi::addon::CSettingValue::GetUInt |
( |
| ) |
const |
|
inline |
To get settings value as unsigned integer.