Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
GlobalsHandling.h File Reference
#include <memory>

Classes

class  xbmcutil::GlobalsSingleton< T >
 
class  xbmcutil::InitFlag
 

Namespaces

namespace  xbmcutil
 

Macros

#define XBMC_GLOBAL_REF(classname, g_variable)
 
#define XBMC_GLOBAL_USE(classname)
 

Macro Definition Documentation

◆ XBMC_GLOBAL_REF

#define XBMC_GLOBAL_REF ( classname,
g_variable )
Value:
static std::shared_ptr<classname> g_variable##Ref(xbmcutil::GlobalsSingleton<classname>::getInstance())
Definition GlobalsHandling.h:106

For pattern (2) above, you can use the following macro. This pattern is safe to use in all cases but may be very slightly less efficient.

Also, you must also use a #define to replace the actual global variable since there's no way to use a macro to add a #define. An example would be:

XBMC_GLOBAL_REF(CWinSystemWin32DX, g_Windowing); #define g_Windowing XBMC_GLOBAL_USE(CWinSystemWin32DX)

◆ XBMC_GLOBAL_USE

#define XBMC_GLOBAL_USE ( classname)
Value:
static T * getQuick()
Definition GlobalsHandling.h:160

This declares the actual use of the variable. It needs to be used in another #define of the form:

#define g_variable XBMC_GLOBAL_USE(classname)