Kodi Docs 20.0
Kodi is an open source media player and entertainment hub.
ADDON::CAddon Class Reference

#include <Addon.h>

Inheritance diagram for ADDON::CAddon:
ADDON::IAddon ADDON::CAddonDll ADDON::CContextMenuAddon ADDON::CPluginSource ADDON::CRepository ADDON::CResource ADDON::CScraper ADDON::CService ADDON::CSkinInfo ADDON::CWebinterface KODI::GAME::CController

Public Member Functions

 CAddon (const AddonInfoPtr &addonInfo, TYPE addonType)
 
 ~CAddon () override=default
 
TYPE MainType () const override
 To get the main type of this addon. More...
 
TYPE Type () const override
 To get the on this CAddon class processed addon type. More...
 
bool HasType (TYPE type) const override
 To check complete addon (not only this) contains a type. More...
 
bool HasMainType (TYPE type) const override
 To check complete addon (not only this) has a specific type defined in its first extension point including the provided subcontent e.g. video or audio. More...
 
const CAddonTypeType (TYPE type) const
 The get for given addon type information and extension data. More...
 
std::string ID () const override
 
std::string Name () const override
 
bool IsInUse () const override
 
bool IsBinary () const override
 
AddonVersion Version () const override
 
AddonVersion MinVersion () const override
 
std::string Summary () const override
 
std::string Description () const override
 
std::string Path () const override
 
std::string Profile () const override
 
std::string LibPath () const override
 
std::string Author () const override
 
std::string ChangeLog () const override
 
std::string Icon () const override
 
ArtMap Art () const override
 
std::vector< std::string > Screenshots () const override
 
std::string Disclaimer () const override
 
AddonLifecycleState LifecycleState () const override
 
std::string LifecycleStateDescription () const override
 
CDateTime InstallDate () const override
 
CDateTime LastUpdated () const override
 
CDateTime LastUsed () const override
 
std::string Origin () const override
 
std::string OriginName () const override
 
uint64_t PackageSize () const override
 
const InfoMapExtraInfo () const override
 
const std::vector< DependencyInfo > & GetDependencies () const override
 
std::string FanArt () const override
 
bool HasSettings () override
 Check whether the this addon can be configured or not. More...
 
virtual bool HasUserSettings ()
 Check whether the user has configured this addon or not. More...
 
void SaveSettings () override
 Save any user configured settings. More...
 
void UpdateSetting (const std::string &key, const std::string &value) override
 Update a user-configured setting with a new value. More...
 
bool UpdateSettingBool (const std::string &key, bool value) override
 Update a user-configured setting with a new boolean value. More...
 
bool UpdateSettingInt (const std::string &key, int value) override
 Update a user-configured setting with a new integer value. More...
 
bool UpdateSettingNumber (const std::string &key, double value) override
 Update a user-configured setting with a new number value. More...
 
bool UpdateSettingString (const std::string &key, const std::string &value) override
 Update a user-configured setting with a new string value. More...
 
std::string GetSetting (const std::string &key) override
 Retrieve a particular settings value If a previously configured user setting is available, we return it's value, else we return the default (if available) More...
 
bool GetSettingBool (const std::string &key, bool &value) override
 Retrieve a particular settings value as boolean If a previously configured user setting is available, we return it's value, else we return the default (if available) More...
 
bool GetSettingInt (const std::string &key, int &value) override
 Retrieve a particular settings value as integer If a previously configured user setting is available, we return it's value, else we return the default (if available) More...
 
bool GetSettingNumber (const std::string &key, double &value) override
 Retrieve a particular settings value as number If a previously configured user setting is available, we return it's value, else we return the default (if available) More...
 
bool GetSettingString (const std::string &key, std::string &value) override
 Retrieve a particular settings value as string If a previously configured user setting is available, we return it's value, else we return the default (if available) More...
 
std::shared_ptr< CAddonSettingsGetSettings () override
 
AddonVersion GetDependencyVersion (const std::string &dependencyID) const override
 get the required version of a dependency. More...
 
bool MeetsVersion (const AddonVersion &versionMin, const AddonVersion &version) const override
 return whether or not this addon satisfies the given version requirements More...
 
bool ReloadSettings () override
 
void ResetSettings () override
 
AddonPtr GetRunningInstance () const override
 retrieve the running instance of an add-on if it persists while running. More...
 
void OnPreInstall () override
 
void OnPostInstall (bool update, bool modal) override
 
void OnPreUnInstall () override
 
void OnPostUnInstall () override
 
- Public Member Functions inherited from ADDON::IAddon
virtual ~IAddon ()=default
 

Protected Member Functions

virtual bool SettingsInitialized () const
 Whether or not the settings have been initialized. More...
 
virtual bool SettingsLoaded () const
 Whether or not the settings have been loaded. More...
 
bool LoadSettings (bool bForce, bool loadUserSettings=true)
 Load the default settings and override these with any previously configured user settings. More...
 
virtual bool LoadUserSettings ()
 Load the user settings. More...
 
virtual bool HasSettingsToSave () const
 
virtual bool SettingsFromXML (const CXBMCTinyXML &doc, bool loadDefaults=false)
 Parse settings from an XML document. More...
 
virtual bool SettingsToXML (CXBMCTinyXML &doc) const
 Write settings into an XML document. More...
 

Protected Attributes

const AddonInfoPtr m_addonInfo
 
std::string m_userSettingsPath
 

Constructor & Destructor Documentation

◆ CAddon()

ADDON::CAddon::CAddon ( const AddonInfoPtr addonInfo,
TYPE  addonType 
)
explicit

◆ ~CAddon()

ADDON::CAddon::~CAddon ( )
overridedefault

Member Function Documentation

◆ Art()

ArtMap ADDON::CAddon::Art ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ Author()

std::string ADDON::CAddon::Author ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ ChangeLog()

std::string ADDON::CAddon::ChangeLog ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ Description()

std::string ADDON::CAddon::Description ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ Disclaimer()

std::string ADDON::CAddon::Disclaimer ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ ExtraInfo()

const InfoMap & ADDON::CAddon::ExtraInfo ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ FanArt()

std::string ADDON::CAddon::FanArt ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ GetDependencies()

const std::vector< DependencyInfo > & ADDON::CAddon::GetDependencies ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ GetDependencyVersion()

AddonVersion ADDON::CAddon::GetDependencyVersion ( const std::string &  dependencyID) const
overridevirtual

get the required version of a dependency.

Parameters
dependencyIDthe addon ID of the dependency.
Returns
the version this addon requires.

Implements ADDON::IAddon.

◆ GetRunningInstance()

AddonPtr ADDON::CAddon::GetRunningInstance ( ) const
inlineoverridevirtual

retrieve the running instance of an add-on if it persists while running.

Implements ADDON::IAddon.

Reimplemented in ADDON::CAddonDll, and KODI::GAME::CGameClient.

◆ GetSetting()

std::string ADDON::CAddon::GetSetting ( const std::string &  key)
overridevirtual

Retrieve a particular settings value If a previously configured user setting is available, we return it's value, else we return the default (if available)

Parameters
keythe id of the setting to retrieve
Returns
the current value of the setting, or the default if the setting has yet to be configured.
See also
LoadSettings, LoadUserSettings, SaveSettings, HasSettings, HasUserSettings, UpdateSetting

Implements ADDON::IAddon.

◆ GetSettingBool()

bool ADDON::CAddon::GetSettingBool ( const std::string &  key,
bool value 
)
overridevirtual

Retrieve a particular settings value as boolean If a previously configured user setting is available, we return it's value, else we return the default (if available)

Parameters
keythe id of the setting to retrieve
valuethe current value of the setting, or the default if the setting has yet to be configured
Returns
true if the setting's value was retrieved, false otherwise.
See also
LoadSettings, LoadUserSettings, SaveSettings, HasSettings, HasUserSettings, UpdateSetting

Implements ADDON::IAddon.

◆ GetSettingInt()

bool ADDON::CAddon::GetSettingInt ( const std::string &  key,
int value 
)
overridevirtual

Retrieve a particular settings value as integer If a previously configured user setting is available, we return it's value, else we return the default (if available)

Parameters
keythe id of the setting to retrieve
valuethe current value of the setting, or the default if the setting has yet to be configured
Returns
true if the setting's value was retrieved, false otherwise.
See also
LoadSettings, LoadUserSettings, SaveSettings, HasSettings, HasUserSettings, UpdateSetting

Implements ADDON::IAddon.

◆ GetSettingNumber()

bool ADDON::CAddon::GetSettingNumber ( const std::string &  key,
double &  value 
)
overridevirtual

Retrieve a particular settings value as number If a previously configured user setting is available, we return it's value, else we return the default (if available)

Parameters
keythe id of the setting to retrieve
valuethe current value of the setting, or the default if the setting has yet to be configured
Returns
true if the setting's value was retrieved, false otherwise.
See also
LoadSettings, LoadUserSettings, SaveSettings, HasSettings, HasUserSettings, UpdateSetting

Implements ADDON::IAddon.

◆ GetSettings()

std::shared_ptr< CAddonSettings > ADDON::CAddon::GetSettings ( )
overridevirtual

Implements ADDON::IAddon.

◆ GetSettingString()

bool ADDON::CAddon::GetSettingString ( const std::string &  key,
std::string &  value 
)
overridevirtual

Retrieve a particular settings value as string If a previously configured user setting is available, we return it's value, else we return the default (if available)

Parameters
keythe id of the setting to retrieve
valuethe current value of the setting, or the default if the setting has yet to be configured
Returns
true if the setting's value was retrieved, false otherwise.
See also
LoadSettings, LoadUserSettings, SaveSettings, HasSettings, HasUserSettings, UpdateSetting

Implements ADDON::IAddon.

◆ HasMainType()

bool ADDON::CAddon::HasMainType ( TYPE  type) const
inlineoverridevirtual

To check complete addon (not only this) has a specific type defined in its first extension point including the provided subcontent e.g. video or audio.

Parameters
[in]typeType identifier to be checked
Returns
true in case the wanted type is the main type, false if not

Implements ADDON::IAddon.

◆ HasSettings()

bool ADDON::CAddon::HasSettings ( )
overridevirtual

Check whether the this addon can be configured or not.

Returns
true if the addon has settings, false otherwise
See also
LoadSettings, LoadUserSettings, SaveSettings, HasUserSettings, GetSetting, UpdateSetting

Settings Handling

Implements ADDON::IAddon.

Reimplemented in ADDON::CSkinInfo.

◆ HasSettingsToSave()

bool ADDON::CAddon::HasSettingsToSave ( ) const
protectedvirtual

◆ HasType()

bool ADDON::CAddon::HasType ( TYPE  type) const
inlineoverridevirtual

To check complete addon (not only this) contains a type.

Note
This can be overridden by a child e.g. plugin to check for subtype e.g. video or music.
Parameters
[in]typeThe to checked type identifier
Returns
true in case the wanted type is supported, false if not

Implements ADDON::IAddon.

Reimplemented in ADDON::CPluginSource.

◆ HasUserSettings()

bool ADDON::CAddon::HasUserSettings ( )
virtual

Check whether the user has configured this addon or not.

Returns
true if previously saved settings are found, false otherwise
See also
LoadSettings, LoadUserSettings, SaveSettings, HasSettings, GetSetting, UpdateSetting

Reimplemented in ADDON::CSkinInfo.

◆ Icon()

std::string ADDON::CAddon::Icon ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ ID()

std::string ADDON::CAddon::ID ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ InstallDate()

CDateTime ADDON::CAddon::InstallDate ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ IsBinary()

bool ADDON::CAddon::IsBinary ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ IsInUse()

bool ADDON::CAddon::IsInUse ( ) const
inlineoverridevirtual

◆ LastUpdated()

CDateTime ADDON::CAddon::LastUpdated ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ LastUsed()

CDateTime ADDON::CAddon::LastUsed ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ LibPath()

std::string ADDON::CAddon::LibPath ( ) const
overridevirtual

Implements ADDON::IAddon.

Reimplemented in ADDON::CAddonDll, and KODI::GAME::CGameClient.

◆ LifecycleState()

AddonLifecycleState ADDON::CAddon::LifecycleState ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ LifecycleStateDescription()

std::string ADDON::CAddon::LifecycleStateDescription ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ LoadSettings()

bool ADDON::CAddon::LoadSettings ( bool  bForce,
bool  loadUserSettings = true 
)
protected

Load the default settings and override these with any previously configured user settings.

Parameters
bForceforce the load of settings even if they are already loaded (reload)
loadUserSettingswhether or not to load user settings
Returns
true if settings exist, false otherwise
See also
LoadUserSettings, SaveSettings, HasSettings, HasUserSettings, GetSetting, UpdateSetting

◆ LoadUserSettings()

bool ADDON::CAddon::LoadUserSettings ( )
protectedvirtual

Load the user settings.

Returns
true if user settings exist, false otherwise
See also
LoadSettings, SaveSettings, HasSettings, HasUserSettings, GetSetting, UpdateSetting

◆ MainType()

TYPE ADDON::CAddon::MainType ( ) const
inlineoverridevirtual

To get the main type of this addon.

This is the first type defined in addon.xml and can be different to the on Type() defined type.

Returns
The used main type of addon

Implements ADDON::IAddon.

◆ MeetsVersion()

bool ADDON::CAddon::MeetsVersion ( const AddonVersion versionMin,
const AddonVersion version 
) const
inlineoverridevirtual

return whether or not this addon satisfies the given version requirements

Parameters
versionthe version to meet.
Returns
true if min_version <= version <= current_version, false otherwise.

Implements ADDON::IAddon.

◆ MinVersion()

AddonVersion ADDON::CAddon::MinVersion ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ Name()

std::string ADDON::CAddon::Name ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ OnPostInstall()

void ADDON::CAddon::OnPostInstall ( bool  update,
bool  modal 
)
inlineoverridevirtual

◆ OnPostUnInstall()

void ADDON::CAddon::OnPostUnInstall ( )
inlineoverridevirtual

Implements ADDON::IAddon.

Reimplemented in ADDON::CAddonDll.

◆ OnPreInstall()

void ADDON::CAddon::OnPreInstall ( )
inlineoverridevirtual

Implements ADDON::IAddon.

Reimplemented in ADDON::CAddonDll, and ADDON::CSkinInfo.

◆ OnPreUnInstall()

void ADDON::CAddon::OnPreUnInstall ( )
inlineoverridevirtual

Implements ADDON::IAddon.

Reimplemented in ADDON::CAddonDll, and ADDON::CImageResource.

◆ Origin()

std::string ADDON::CAddon::Origin ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ OriginName()

std::string ADDON::CAddon::OriginName ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ PackageSize()

uint64_t ADDON::CAddon::PackageSize ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ Path()

std::string ADDON::CAddon::Path ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ Profile()

std::string ADDON::CAddon::Profile ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ ReloadSettings()

bool ADDON::CAddon::ReloadSettings ( )
overridevirtual

Implements ADDON::IAddon.

◆ ResetSettings()

void ADDON::CAddon::ResetSettings ( )
overridevirtual

Implements ADDON::IAddon.

◆ SaveSettings()

void ADDON::CAddon::SaveSettings ( void  )
overridevirtual

Save any user configured settings.

See also
LoadSettings, LoadUserSettings, HasSettings, HasUserSettings, GetSetting, UpdateSetting

Implements ADDON::IAddon.

Reimplemented in ADDON::CAddonDll.

◆ Screenshots()

std::vector< std::string > ADDON::CAddon::Screenshots ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ SettingsFromXML()

bool ADDON::CAddon::SettingsFromXML ( const CXBMCTinyXML doc,
bool  loadDefaults = false 
)
protectedvirtual

Parse settings from an XML document.

Parameters
docXML document to parse for settings
loadDefaultsif true, the default attribute is used and settings are reset prior to parsing, else the value attribute is used.
Returns
true if settings are loaded, false otherwise
See also
SettingsToXML

Reimplemented in ADDON::CSkinInfo.

◆ SettingsInitialized()

bool ADDON::CAddon::SettingsInitialized ( ) const
protectedvirtual

Whether or not the settings have been initialized.

Reimplemented in ADDON::CSkinInfo.

◆ SettingsLoaded()

bool ADDON::CAddon::SettingsLoaded ( ) const
protectedvirtual

Whether or not the settings have been loaded.

Reimplemented in ADDON::CSkinInfo.

◆ SettingsToXML()

bool ADDON::CAddon::SettingsToXML ( CXBMCTinyXML doc) const
protectedvirtual

Write settings into an XML document.

Parameters
docXML document to receive the settings
Returns
true if settings are saved, false otherwise
See also
SettingsFromXML

Reimplemented in ADDON::CSkinInfo.

◆ Summary()

std::string ADDON::CAddon::Summary ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

◆ Type() [1/2]

TYPE ADDON::CAddon::Type ( ) const
inlineoverridevirtual

To get the on this CAddon class processed addon type.

Returns
For this class used addon type

Implements ADDON::IAddon.

◆ Type() [2/2]

const CAddonType * ADDON::CAddon::Type ( TYPE  type) const
inline

The get for given addon type information and extension data.

Parameters
[in]typeThe wanted type data
Returns
addon type class with CAddonExtensions as information
Note
This function return never a "nullptr", in case the wanted type is not supported, becomes a dummy of CAddonType given.

Example:

// To get e.g. <extension ... name="blablabla" /> from addon.xml
std::string name = Type(ADDON_...)->GetValue("@name").asString();
TYPE Type() const override
To get the on this CAddon class processed addon type.
Definition: addons/Addon.h:51

◆ UpdateSetting()

void ADDON::CAddon::UpdateSetting ( const std::string &  key,
const std::string &  value 
)
overridevirtual

Update a user-configured setting with a new value.

Parameters
keythe id of the setting to update
valuethe value that the setting should take
See also
LoadSettings, LoadUserSettings, SaveSettings, HasSettings, HasUserSettings, GetSetting

Implements ADDON::IAddon.

◆ UpdateSettingBool()

bool ADDON::CAddon::UpdateSettingBool ( const std::string &  key,
bool  value 
)
overridevirtual

Update a user-configured setting with a new boolean value.

Parameters
keythe id of the setting to update
valuethe value that the setting should take
See also
LoadSettings, LoadUserSettings, SaveSettings, HasSettings, HasUserSettings, GetSetting

Implements ADDON::IAddon.

◆ UpdateSettingInt()

bool ADDON::CAddon::UpdateSettingInt ( const std::string &  key,
int  value 
)
overridevirtual

Update a user-configured setting with a new integer value.

Parameters
keythe id of the setting to update
valuethe value that the setting should take
See also
LoadSettings, LoadUserSettings, SaveSettings, HasSettings, HasUserSettings, GetSetting

Implements ADDON::IAddon.

◆ UpdateSettingNumber()

bool ADDON::CAddon::UpdateSettingNumber ( const std::string &  key,
double  value 
)
overridevirtual

Update a user-configured setting with a new number value.

Parameters
keythe id of the setting to update
valuethe value that the setting should take
See also
LoadSettings, LoadUserSettings, SaveSettings, HasSettings, HasUserSettings, GetSetting

Implements ADDON::IAddon.

◆ UpdateSettingString()

bool ADDON::CAddon::UpdateSettingString ( const std::string &  key,
const std::string &  value 
)
overridevirtual

Update a user-configured setting with a new string value.

Parameters
keythe id of the setting to update
valuethe value that the setting should take
See also
LoadSettings, LoadUserSettings, SaveSettings, HasSettings, HasUserSettings, GetSetting

Implements ADDON::IAddon.

◆ Version()

AddonVersion ADDON::CAddon::Version ( ) const
inlineoverridevirtual

Implements ADDON::IAddon.

Member Data Documentation

◆ m_addonInfo

const AddonInfoPtr ADDON::CAddon::m_addonInfo
protected

◆ m_userSettingsPath

std::string ADDON::CAddon::m_userSettingsPath
protected

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