Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
swighelper.h File Reference

Macros

#define SWIGHIDDENVIRTUAL   virtual
 
#define SWIG_CONSTANT_FROM_GETTER(type, varname)
 
#define SWIG_CONSTANT(type, var)
 
#define SWIG_CONSTANT2(type, var, val)
 
#define SWIG_IMMUTABLE(var)
 

Macro Definition Documentation

◆ SWIG_CONSTANT

#define SWIG_CONSTANT ( type,
var )

SWIG_CONSTANT defines a constant in SWIG from an already existing definition in the Addon api. E.g. a #define from the core window system like SORT_METHOD_PROGRAM_COUNT included in the api via a #include can be exposed to the scripting language using SWIG_CONSTANT(int,SORT_METHOD_PROGRAM_COUNT).

This macro can be used when the constant name and the C++ reference look the same. When they look different see SWIG_CONSTANT2

Note, this declaration is invisible to the API C++ code and can only be seen by the SWIG processor.

◆ SWIG_CONSTANT2

#define SWIG_CONSTANT2 ( type,
var,
val )

SWIG_CONSTANT2 defines a constant in SWIG from an already existing definition in the Addon api. E.g. a #define from the core window system like SORT_METHOD_VIDEO_YEAR included in the api via a #include can be exposed to the scripting language using SWIG_CONSTANT2(int,SORT_METHOD_VIDEO_YEAR,SORT_METHOD_YEAR).

This macro can be used when the constant name and the C++ reference don't look the same. When they look the same see SWIG_CONSTANT

Note, this declaration is invisible to the API C++ code and can only be seen by the SWIG processor.

◆ SWIG_CONSTANT_FROM_GETTER

#define SWIG_CONSTANT_FROM_GETTER ( type,
varname )
Value:
type get##varname ()

SWIG_CONSTANT_FROM_GETTER will define a constant in the scripting language from a getter in the Addon api and also provide the Addon api declaration. E.g. If you use:

SWIG_CONSTANT_FROM_GETTER(int, MY_CONSTANT);

... in an Addon api header file then you need to define a function:

int getMy_CONSTANT();

... in a .cpp file. That call will be made to determine the value of the constant in the scripting language.

◆ SWIG_IMMUTABLE

#define SWIG_IMMUTABLE ( var)
Value:
var

SWIG_IMMUTABLE defines a member as immutable i.e. read-only.

Note, this declaration is invisible to the API C++ code and can only be seen by the SWIG processor.

◆ SWIGHIDDENVIRTUAL

#define SWIGHIDDENVIRTUAL   virtual

SWIGHIDDENVIRTUAL allows the keyword 'virtual' to be there when the main Addon api is compiled, but be hidden from the SWIG code generator.

This is to provide finer grain control over which methods are callbackable (is that a word? ...) into the scripting language, and which ones are not. True polymorphic behavior across the scripting language boundary will ONLY occur where the keyword 'virtual' is used. In other words, you can use the macro SWIGHIDDENVIRTUAL to 'hide' the polymorphic behavior from the scripting language using the macro instead.

Note: You should not hide virtual destructors from the scripting language.