Kodi Documentation
Kodi is an open source media player and entertainment hub.
XBMCAddon::LanguageHook Class Referenceabstract

#include <LanguageHook.h>

Inheritance diagram for XBMCAddon::LanguageHook:
Collaboration diagram for XBMCAddon::LanguageHook:

Public Member Functions

 ~LanguageHook () override
 
virtual void DelayedCallOpen ()
 
virtual void DelayedCallClose ()
 
virtual void MakePendingCalls ()
 
virtual CallbackHandlerGetCallbackHandler ()
 
virtual void Constructing (AddonClass *beingConstructed)
 
virtual void Destructing (AddonClass *beingDestructed)
 
virtual String GetAddonId ()
 
virtual String GetAddonVersion ()
 
virtual long GetInvokerId ()
 
virtual void RegisterPlayerCallback (IPlayerCallback *player)=0
 
virtual void UnregisterPlayerCallback (IPlayerCallback *player)=0
 
virtual void RegisterMonitorCallback (XBMCAddon::xbmc::Monitor *player)=0
 
virtual void UnregisterMonitorCallback (XBMCAddon::xbmc::Monitor *player)=0
 
virtual bool WaitForEvent (CEvent &hEvent, unsigned int milliseconds)=0
 
- Public Member Functions inherited from XBMCAddon::AddonClass
 AddonClass ()
 
virtual ~AddonClass ()
 
const char * GetClassname () const
 
LanguageHookGetLanguageHook ()
 
bool isDeallocating ()
 
void Release () const
 
void Acquire () const
 
- Public Member Functions inherited from XbmcThreads::CountingLockable< XbmcThreads::CRecursiveMutex >
 CountingLockable ()=default
 
void lock ()
 
bool try_lock ()
 
void unlock ()
 
unsigned int exit (unsigned int leave=0)
 
void restore (unsigned int restoreCount)
 
XbmcThreads::CRecursiveMutex & get_underlying ()
 

Static Public Member Functions

static void SetLanguageHook (LanguageHook *languageHook)
 
static LanguageHookGetLanguageHook ()
 
static void ClearLanguageHook ()
 
- Static Public Member Functions inherited from XBMCAddon::AddonClass
static short getNumAddonClasses ()
 

Protected Member Functions

 LanguageHook ()=default
 
- Protected Member Functions inherited from XBMCAddon::AddonClass
virtual void deallocating ()
 

Additional Inherited Members

- Static Protected Member Functions inherited from XBMCAddon::AddonClass
static short getNextClassIndex ()
 
- Protected Attributes inherited from XBMCAddon::AddonClass
LanguageHooklanguageHook
 
- Protected Attributes inherited from XbmcThreads::CountingLockable< XbmcThreads::CRecursiveMutex >
XbmcThreads::CRecursiveMutex mutex
 
unsigned int count
 

Constructor & Destructor Documentation

◆ LanguageHook()

XBMCAddon::LanguageHook::LanguageHook ( )
inlineprotecteddefault

◆ ~LanguageHook()

XBMCAddon::LanguageHook::~LanguageHook ( )
overridedefault

Member Function Documentation

◆ ClearLanguageHook()

void XBMCAddon::LanguageHook::ClearLanguageHook ( )
static

◆ Constructing()

virtual void XBMCAddon::LanguageHook::Constructing ( AddonClass beingConstructed)
inlinevirtual

This is a callback method that can be overridden to receive a callback when an AddonClass that has this language hook is on is being constructed. It is called from the constructor of AddonClass so the implementor cannot assume the subclasses have been built or that calling a virtual function on the AddonClass will work as expected.

◆ DelayedCallClose()

virtual void XBMCAddon::LanguageHook::DelayedCallClose ( )
inlinevirtual

If the scripting language needs special handling for calls that block or are delayed in any other means, this should be overloaded.

In Python when control is passed to a native method that blocks, you need to allow other threads in Python to run by using Py_BEGIN_ALLOW_THREADS. When that delayed method ends you need to restore the Python thread state using Py_END_ALLOW_THREADS. This is the place to put that functionality

Reimplemented in XBMCAddon::Python::PythonLanguageHook.

◆ DelayedCallOpen()

virtual void XBMCAddon::LanguageHook::DelayedCallOpen ( )
inlinevirtual

If the scripting language needs special handling for calls that block or are delayed in any other means, this should be overloaded.

In Python when control is passed to a native method that blocks, you need to allow other threads in Python to run by using Py_BEGIN_ALLOW_THREADS. This is the place to put that functionality

Reimplemented in XBMCAddon::Python::PythonLanguageHook.

◆ Destructing()

virtual void XBMCAddon::LanguageHook::Destructing ( AddonClass beingDestructed)
inlinevirtual

This is a callback method that can be overridden to receive a callback when an AddonClass that has this language hook is on is being destructed. It is called from the destructor of AddonClass so the implementor should assume the subclasses have been torn down and that calling a virtual function on the AddonClass will not work as expected.

◆ GetAddonId()

virtual String XBMCAddon::LanguageHook::GetAddonId ( )
inlinevirtual

This method should be done a different way but since the only other way I can think to do it requires an InheritableThreadLocal C++ equivalent, I'm going to defer to this technique for now.

Currently (for python) the scripting language has the Addon id injected into it as a global variable. Therefore the only way to retrieve it is to use scripting language specific calls. So until I figure out a better way to do this, this is how I need to retrieve it.

Reimplemented in XBMCAddon::Python::PythonLanguageHook.

◆ GetAddonVersion()

virtual String XBMCAddon::LanguageHook::GetAddonVersion ( )
inlinevirtual

◆ GetCallbackHandler()

virtual CallbackHandler* XBMCAddon::LanguageHook::GetCallbackHandler ( )
inlinevirtual

For scripting languages that need a global callback handler, this method should be overloaded to supply one.

Reimplemented in XBMCAddon::Python::PythonLanguageHook.

◆ GetInvokerId()

virtual long XBMCAddon::LanguageHook::GetInvokerId ( )
inlinevirtual

◆ GetLanguageHook()

LanguageHook * XBMCAddon::LanguageHook::GetLanguageHook ( )
static

◆ MakePendingCalls()

virtual void XBMCAddon::LanguageHook::MakePendingCalls ( )
inlinevirtual

◆ RegisterMonitorCallback()

virtual void XBMCAddon::LanguageHook::RegisterMonitorCallback ( XBMCAddon::xbmc::Monitor player)
pure virtual

◆ RegisterPlayerCallback()

virtual void XBMCAddon::LanguageHook::RegisterPlayerCallback ( IPlayerCallback player)
pure virtual

◆ SetLanguageHook()

void XBMCAddon::LanguageHook::SetLanguageHook ( LanguageHook languageHook)
static

◆ UnregisterMonitorCallback()

virtual void XBMCAddon::LanguageHook::UnregisterMonitorCallback ( XBMCAddon::xbmc::Monitor player)
pure virtual

◆ UnregisterPlayerCallback()

virtual void XBMCAddon::LanguageHook::UnregisterPlayerCallback ( IPlayerCallback player)
pure virtual

◆ WaitForEvent()

virtual bool XBMCAddon::LanguageHook::WaitForEvent ( CEvent hEvent,
unsigned int  milliseconds 
)
pure virtual

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