Functions to handle settings access
This can be used to get and set the addon related values inside his settings.xml.
The settings style is given with installed part on e.g. $HOME/.kodi/addons/myspecial.addon/resources/settings.xml
. The related edit becomes then stored inside $HOME/.kodi/userdata/addon_data/myspecial.addon/settings.xml
.
◆ IsSettingUsingDefault()
bool ATTRIBUTE_HIDDEN kodi::IsSettingUsingDefault |
( |
const std::string & |
settingName | ) |
|
|
inline |
Check the given setting name is set to default value.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of asked setting |
- Returns
- true if setting is the default
◆ CheckSettingString()
bool ATTRIBUTE_HIDDEN kodi::CheckSettingString |
( |
const std::string & |
settingName, |
|
|
std::string & |
settingValue |
|
) |
| |
|
inline |
Check and get a string setting value.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of asked setting |
[out] | settingValue | The given setting value |
- Returns
- true if setting was successfully found and "settingValue" is set
- Note
- If returns false, the "settingValue" is not changed.
Example:
#include <kodi/General.h>
std::string value;
value = "my_default_if_setting_not_work";
bool ATTRIBUTE_HIDDEN CheckSettingString(const std::string &settingName, std::string &settingValue)
Check and get a string setting value.
Definition: AddonBase.h:815
◆ GetSettingString()
std::string ATTRIBUTE_HIDDEN kodi::GetSettingString |
( |
const std::string & |
settingName, |
|
|
const std::string & |
defaultValue = "" |
|
) |
| |
|
inline |
Get string setting value.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of asked setting |
[in] | defaultValue | [opt] Default value if not found |
- Returns
- The value of setting, empty if not found;
Example:
#include <kodi/General.h>
std::string ATTRIBUTE_HIDDEN GetSettingString(const std::string &settingName, const std::string &defaultValue="")
Get string setting value.
Definition: AddonBase.h:852
◆ SetSettingString()
void ATTRIBUTE_HIDDEN kodi::SetSettingString |
( |
const std::string & |
settingName, |
|
|
const std::string & |
settingValue |
|
) |
| |
|
inline |
Set string setting of addon.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of setting |
[in] | settingValue | The setting value to write |
Example:
#include <kodi/General.h>
std::string value = "my_new_name for";
void ATTRIBUTE_HIDDEN SetSettingString(const std::string &settingName, const std::string &settingValue)
Set string setting of addon.
Definition: AddonBase.h:880
◆ CheckSettingInt()
bool ATTRIBUTE_HIDDEN kodi::CheckSettingInt |
( |
const std::string & |
settingName, |
|
|
int & |
settingValue |
|
) |
| |
|
inline |
Check and get a integer setting value.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of asked setting |
[out] | settingValue | The given setting value |
- Returns
- true if setting was successfully found and "settingValue" is set
- Note
- If returns false, the "settingValue" is not changed.
Example:
#include <kodi/General.h>
int value = 0;
value = 123;
bool ATTRIBUTE_HIDDEN CheckSettingInt(const std::string &settingName, int &settingValue)
Check and get a integer setting value.
Definition: AddonBase.h:913
◆ GetSettingInt()
int ATTRIBUTE_HIDDEN kodi::GetSettingInt |
( |
const std::string & |
settingName, |
|
|
int |
defaultValue = 0 |
|
) |
| |
|
inline |
Get integer setting value.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of asked setting |
[in] | defaultValue | [opt] Default value if not found |
- Returns
- The value of setting,
0
or defaultValue if not found
Example:
#include <kodi/General.h>
int ATTRIBUTE_HIDDEN GetSettingInt(const std::string &settingName, int defaultValue=0)
Get integer setting value.
Definition: AddonBase.h:941
◆ SetSettingInt()
void ATTRIBUTE_HIDDEN kodi::SetSettingInt |
( |
const std::string & |
settingName, |
|
|
int |
settingValue |
|
) |
| |
|
inline |
Set integer setting of addon.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of setting |
[in] | settingValue | The setting value to write |
Example:
#include <kodi/General.h>
int value = 123;
void ATTRIBUTE_HIDDEN SetSettingInt(const std::string &settingName, int settingValue)
Set integer setting of addon.
Definition: AddonBase.h:968
◆ CheckSettingBoolean()
bool ATTRIBUTE_HIDDEN kodi::CheckSettingBoolean |
( |
const std::string & |
settingName, |
|
|
bool & |
settingValue |
|
) |
| |
|
inline |
Check and get a boolean setting value.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of asked setting |
[out] | settingValue | The given setting value |
- Returns
- true if setting was successfully found and "settingValue" is set
- Note
- If returns false, the "settingValue" is not changed.
Example:
#include <kodi/General.h>
bool value = false;
value = true;
bool ATTRIBUTE_HIDDEN CheckSettingBoolean(const std::string &settingName, bool &settingValue)
Check and get a boolean setting value.
Definition: AddonBase.h:1000
◆ GetSettingBoolean()
bool ATTRIBUTE_HIDDEN kodi::GetSettingBoolean |
( |
const std::string & |
settingName, |
|
|
bool |
defaultValue = false |
|
) |
| |
|
inline |
Get boolean setting value.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of asked setting |
[in] | defaultValue | [opt] Default value if not found |
- Returns
- The value of setting,
false
or defaultValue if not found
Example:
#include <kodi/General.h>
bool ATTRIBUTE_HIDDEN GetSettingBoolean(const std::string &settingName, bool defaultValue=false)
Get boolean setting value.
Definition: AddonBase.h:1028
◆ SetSettingBoolean()
void ATTRIBUTE_HIDDEN kodi::SetSettingBoolean |
( |
const std::string & |
settingName, |
|
|
bool |
settingValue |
|
) |
| |
|
inline |
Set boolean setting of addon.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of setting |
[in] | settingValue | The setting value to write |
Example:
#include <kodi/General.h>
bool value = true;
void ATTRIBUTE_HIDDEN SetSettingBoolean(const std::string &settingName, bool settingValue)
Set boolean setting of addon.
Definition: AddonBase.h:1056
◆ CheckSettingFloat()
bool ATTRIBUTE_HIDDEN kodi::CheckSettingFloat |
( |
const std::string & |
settingName, |
|
|
float & |
settingValue |
|
) |
| |
|
inline |
Check and get a floating point setting value.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of asked setting |
[out] | settingValue | The given setting value |
- Returns
- true if setting was successfully found and "settingValue" is set
- Note
- If returns false, the "settingValue" is not changed.
Example:
#include <kodi/General.h>
float value = 0.0f;
value = 1.0f;
◆ GetSettingFloat()
float ATTRIBUTE_HIDDEN kodi::GetSettingFloat |
( |
const std::string & |
settingName, |
|
|
float |
defaultValue = 0.0f |
|
) |
| |
|
inline |
Get floating point setting value.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of asked setting |
[in] | defaultValue | [opt] Default value if not found |
- Returns
- The value of setting,
0.0
or defaultValue if not found
Example:
#include <kodi/General.h>
float ATTRIBUTE_HIDDEN GetSettingFloat(const std::string &settingName, float defaultValue=0.0f)
Get floating point setting value.
Definition: AddonBase.h:1116
◆ SetSettingFloat()
void ATTRIBUTE_HIDDEN kodi::SetSettingFloat |
( |
const std::string & |
settingName, |
|
|
float |
settingValue |
|
) |
| |
|
inline |
Set floating point setting of addon.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of setting |
[in] | settingValue | The setting value to write |
Example:
#include <kodi/General.h>
float value = 1.0f;
void ATTRIBUTE_HIDDEN SetSettingFloat(const std::string &settingName, float settingValue)
Set floating point setting of addon.
Definition: AddonBase.h:1144
◆ CheckSettingEnum()
bool ATTRIBUTE_HIDDEN kodi::CheckSettingEnum |
( |
const std::string & |
settingName, |
|
|
enumType & |
settingValue |
|
) |
| |
|
inline |
Check and get a enum setting value.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of asked setting |
[out] | settingValue | The given setting value |
- Returns
- true if setting was successfully found and "settingValue" is set
- Note
- If returns false, the "settingValue" is not changed.
Example:
#include <kodi/General.h>
enum myEnumValue
{
valueA,
valueB,
valueC
};
myEnumValue value;
if (!kodi::CheckSettingEnum<myEnumValue>("my_enum_value", value))
value = valueA;
◆ GetSettingEnum()
enumType ATTRIBUTE_HIDDEN kodi::GetSettingEnum |
( |
const std::string & |
settingName, |
|
|
enumType |
defaultValue = static_cast<enumType>(0) |
|
) |
| |
|
inline |
Get enum setting value.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of asked setting |
[in] | defaultValue | [opt] Default value if not found |
- Returns
- The value of setting, forced to
0
or defaultValue if not found
Example:
#include <kodi/General.h>
enum myEnumValue
{
valueA,
valueB,
valueC
};
myEnumValue value = kodi::GetSettingEnum<myEnumValue>("my_enum_value");
◆ SetSettingEnum()
void ATTRIBUTE_HIDDEN kodi::SetSettingEnum |
( |
const std::string & |
settingName, |
|
|
enumType |
settingValue |
|
) |
| |
|
inline |
Set enum setting of addon.
The setting name relate to names used in his settings.xml file.
- Parameters
-
[in] | settingName | The name of setting |
[in] | settingValue | The setting value to write |
Example:
#include <kodi/General.h>
enum myEnumValue
{
valueA,
valueB,
valueC
};
myEnumValue value = valueA;
kodi::SetSettingEnum<myEnumValue>("my_enum_value", value);