Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
AddonBase.h File Reference
#include "c-api/addon_base.h"
#include "versions.h"
#include <assert.h>
#include <stdarg.h>
#include "tools/StringUtils.h"
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <memory>
#include <stdexcept>
#include <string>
#include <vector>

Classes

struct  kodi::addon::CPrivateBase
 Internal used structure to have stored C API data above and available for everything below. More...
 
class  kodi::addon::CStructHdl< CPP_CLASS, C_STRUCT >
 
class  kodi::addon::DynamicCStructHdl< CPP_CLASS, C_STRUCT >
 
class  kodi::addon::CSettingValue
 
class  kodi::addon::IInstanceInfo
 
class  kodi::addon::IAddonInstance
 
class  kodi::addon::CAddonBase
 

Namespaces

namespace  kodi
 
namespace  kodi::gui
 
namespace  kodi::addon
 

Macros

#define ADDONCREATOR(AddonClass)
 

Typedefs

using kodi::HardwareContext = ADDON_HARDWARE_CONTEXT
 

Functions

char * kodi::addon::AllocAndCopyString (const char *source)
 Internally used helper to dynamically allocate and fill a char array.
 
void kodi::addon::FreeString (const char *str)
 Internally used helper to delete a string that was allocated via AllocAndCopyString.
 
void kodi::addon::ReallocAndCopyString (const char **stringToRealloc, const char *stringToCopy)
 Internally used helper to dynamically reallocate and fill a char array.
 
std::string ATTR_DLL_LOCAL kodi::addon::GetAddonPath (const std::string &append="")
 To get the addon system installation folder.
 
std::string ATTR_DLL_LOCAL kodi::addon::GetLibPath (const std::string &append="")
 This function gives OS associated executable binary path of the addon.
 
std::string ATTR_DLL_LOCAL kodi::addon::GetUserPath (const std::string &append="")
 To get the user-related folder of the addon.
 
std::string ATTR_DLL_LOCAL kodi::addon::GetTempPath (const std::string &append="")
 To get a temporary path for the addon.
 
std::string ATTR_DLL_LOCAL kodi::addon::GetLocalizedString (uint32_t labelId, const std::string &defaultStr="")
 Returns an addon's localized 'unicode string'.
 
bool ATTR_DLL_LOCAL kodi::addon::OpenSettings ()
 Opens this Add-Ons settings dialog.
 
bool ATTR_DLL_LOCAL kodi::addon::IsSettingUsingDefault (const std::string &settingName)
 Check the given setting name is set to default value.
 
bool ATTR_DLL_LOCAL kodi::addon::CheckSettingString (const std::string &settingName, std::string &settingValue)
 Check and get a string setting value.
 
std::string ATTR_DLL_LOCAL kodi::addon::GetSettingString (const std::string &settingName, const std::string &defaultValue="")
 Get string setting value.
 
void ATTR_DLL_LOCAL kodi::addon::SetSettingString (const std::string &settingName, const std::string &settingValue)
 Set string setting of addon.
 
bool ATTR_DLL_LOCAL kodi::addon::CheckSettingInt (const std::string &settingName, int &settingValue)
 Check and get a integer setting value.
 
int ATTR_DLL_LOCAL kodi::addon::GetSettingInt (const std::string &settingName, int defaultValue=0)
 Get integer setting value.
 
void ATTR_DLL_LOCAL kodi::addon::SetSettingInt (const std::string &settingName, int settingValue)
 Set integer setting of addon.
 
bool ATTR_DLL_LOCAL kodi::addon::CheckSettingBoolean (const std::string &settingName, bool &settingValue)
 Check and get a boolean setting value.
 
bool ATTR_DLL_LOCAL kodi::addon::GetSettingBoolean (const std::string &settingName, bool defaultValue=false)
 Get boolean setting value.
 
void ATTR_DLL_LOCAL kodi::addon::SetSettingBoolean (const std::string &settingName, bool settingValue)
 Set boolean setting of addon.
 
bool ATTR_DLL_LOCAL kodi::addon::CheckSettingFloat (const std::string &settingName, float &settingValue)
 Check and get a floating point setting value.
 
float ATTR_DLL_LOCAL kodi::addon::GetSettingFloat (const std::string &settingName, float defaultValue=0.0f)
 Get floating point setting value.
 
void ATTR_DLL_LOCAL kodi::addon::SetSettingFloat (const std::string &settingName, float settingValue)
 Set floating point setting of addon.
 
template<typename enumType >
bool ATTR_DLL_LOCAL kodi::addon::CheckSettingEnum (const std::string &settingName, enumType &settingValue)
 Check and get a enum setting value.
 
template<typename enumType >
enumType ATTR_DLL_LOCAL kodi::addon::GetSettingEnum (const std::string &settingName, enumType defaultValue=static_cast< enumType >(0))
 Get enum setting value.
 
template<typename enumType >
void ATTR_DLL_LOCAL kodi::addon::SetSettingEnum (const std::string &settingName, enumType settingValue)
 Set enum setting of addon.
 
std::string ATTR_DLL_LOCAL kodi::addon::GetAddonInfo (const std::string &id)
 Returns the value of an addon property as a string.
 
voidkodi::addon::GetInterface (const std::string &name, const std::string &version)
 Returns a function table to a named interface.
 
std::string ATTR_DLL_LOCAL kodi::addon::GetKodiTypeVersion (int type)
 To get used version inside Kodi itself about asked type.
 
std::string ATTR_DLL_LOCAL kodi::addon::TranslateAddonStatus (ADDON_STATUS status)
 Get to related ADDON_STATUS a human readable text.
 
void ATTR_DLL_LOCAL kodi::Log (const ADDON_LOG loglevel, const char *format,...)
 Add a message to Kodi's log.
 

Macro Definition Documentation

◆ ADDONCREATOR

#define ADDONCREATOR ( AddonClass)
Value:
extern "C" ATTR_DLL_EXPORT ADDON_STATUS ADDON_Create(KODI_HANDLE addonInterface) \
{ \
using namespace kodi::addon; \
CPrivateBase::m_interface = static_cast<AddonGlobalInterface*>(addonInterface); \
CPrivateBase::m_interface->addonBase = new AddonClass; \
return static_cast<CAddonBase*>(CPrivateBase::m_interface->addonBase)->Create(); \
} \
extern "C" ATTR_DLL_EXPORT const char* ADDON_GetTypeVersion(int type) \
{ \
} \
extern "C" ATTR_DLL_EXPORT const char* ADDON_GetTypeMinVersion(int type) \
{ \
} \
#define ATTR_DLL_EXPORT
Definition addon_base.h:85
void * KODI_HANDLE
Standard undefined pointer handle.
Definition addon_base.h:291
Definition kodi-dev-kit/include/kodi/AddonBase.h:775
ADDON_STATUS
Definition addon_base.h:138
Definition addons/kodi-dev-kit/include/kodi/addon-instance/AudioDecoder.h:23
const char * GetTypeVersion(int type)
Definition versions.h:268
const char * GetTypeMinVersion(int type)
Definition versions.h:360
Main structure passed from kodi to addon with basic information needed to create add-on.
Definition addon_base.h:379
KODI_ADDON_HDL addonBase
Definition addon_base.h:386
static AddonGlobalInterface * m_interface
Definition kodi-dev-kit/include/kodi/AddonBase.h:75