![]() As it is, this is all that's needed to support the entire existing API.Īs mentioned, your class must inherit from AddonClass and define a single constructor. If this is too restrictive feel free to suggest enhancements. Unlike SWIG, this codegenerator doesn't handle typedefs so you'll need to define your API in terms of explicit types.For python you can define a "comparator" (NOT a "rich comparator") if you define these three operators on your API class (you cannot use global operator definitions):.The codegenerator doesn't handle operator overloading and all defined operators will simply be ignored - EXCEPT for the following situation:.The codegenerator cannot (yet) handle overloaded methods or functions. ![]() You need to hide all but one using #ifndef SWIG/#endif pairs. Not have multiple base classes that are visible to the parser/Python.It can handle API classes but they MUST:.std::string, XBMCAddon::String (typedef of std::string).XBMCAddon::Dictionary - this is probably redundant with the std::map and may be removed.Again the template parameter types must also be able to be handled XBMCAddon::Tuple - a 'varadic' template Tuple of (currently) up to four entries.std::vector - as long as the template parameters can also be handled.std::map - as long as the template parameters can also be handled.It can handle all built in types as return values or as parameters (let me know if you find any missing and I can add them).The codegenerator cannot handle every possible case so here is a list of things to keep in mind: Xbmc.test() 1.3 Current requirements/restrictions ![]() Now you can call it from a python script. Let's add this to the file ModuleXbmc.h inside of the namespaces. Suppose we want to add a method called 'test' that can be called from python. ![]() The simplest thing to do is to add a trivial method to an existing module. In order to run the codegenerator on any changes you made to the native api in interfaces/legacy you need to run 'make' from xbmc/interfaces/python. xbmc/interfaces/python contains the template for generating the python specific bindings.xbmc/interfaces/swig contains a SWIG interface file for each module in the API.xbmc/interfaces/legacy contains the C++ code that represents the current (now, legacy) API.The directories within XBMC are organized as follows: You simply write C++ code and make sure that it gets incorporated in the appropriate module file. Now the ability to extend the API should be much simpler. 1.5.1 Cross-language Polymorphism in XBMCġ How to extend the Python API 1.1 How to use the codegenerator.This could be done with either a future SWIG release (a current GCOS project for SWIG is to include documentation) or a separate (optional) doxygen pass. More work will be required to parse out the documentation and include it in the scripting language interface. ![]()
0 Comments
Leave a Reply. |