Kross::Api::ProxyFunction< INSTANCE, METHOD, RETURNOBJ, ARG1OBJ, ARG2OBJ, ARG3OBJ, ARG4OBJ > Class Template Reference
#include <proxy.h>
Inheritance diagram for Kross::Api::ProxyFunction< INSTANCE, METHOD, RETURNOBJ, ARG1OBJ, ARG2OBJ, ARG3OBJ, ARG4OBJ >:
Public Member Functions | |
| ProxyFunction (INSTANCE *instance, const METHOD &method, ARG1OBJ *defarg1=0, ARG2OBJ *defarg2=0, ARG3OBJ *defarg3=0, ARG4OBJ *defarg4=0) | |
| Object::Ptr | call (List::Ptr args) |
Friends | |
| template<class PROXYFUNC, typename RETURNTYPE> | |
| struct | ProxyFunctionCaller |
Detailed Description
template<class INSTANCE, typename METHOD, class RETURNOBJ, class ARG1OBJ = Kross::Api::Object, class ARG2OBJ = Kross::Api::Object, class ARG3OBJ = Kross::Api::Object, class ARG4OBJ = Kross::Api::Object>
class Kross::Api::ProxyFunction< INSTANCE, METHOD, RETURNOBJ, ARG1OBJ, ARG2OBJ, ARG3OBJ, ARG4OBJ >
class Kross::Api::ProxyFunction< INSTANCE, METHOD, RETURNOBJ, ARG1OBJ, ARG2OBJ, ARG3OBJ, ARG4OBJ >
The ProxyFunction template-class is used to publish any C/C++ method (not only slots) of a struct or class instance as a a Function to Kross.
With this class we don't need to have a method-wrapper for each single function what a) should reduce the code needed for wrappers and b) is more typesafe cause the connection to the C/C++ method is done on compiletime.
Example how a ProxyFunction may got used;
#include "../api/class.h"
#include "../api/proxy.h"
// The class which should be published.
public:
// publish the function myfunc, so that scripting-code is able
// to call that method.
this->addProxyFunction <
Kross::Api::Variant, // the uint returnvalue is handled with Variant.
Kross::Api::Variant, // the TQString argument is handled with Variant too.
MyClass // the MyClass* is handled implicit by our class.
> ( "myfuncname", // the name the function should be published as.
this, // pointer to the class-instance which has the method.
&TestPluginObject::myfunc ); // pointer to the method itself.
}
virtual ~MyClass() {}
private:
uint myfunc(const TQCString&, MyClass* myotherclass) {
// This method will be published to the scripting backend. So, scripting
// code is able to call this method.
}
}
From Event inherited template-class to represent class-structures.
Definition class.h:44
Variant value to wrap a TQVariant into a Kross::Api::Value to enable primitive types like strings or ...
Definition variant.h:39
The Kross scripting bridge to embed scripting functionality into an application.
Definition callable.h:33
Constructor & Destructor Documentation
◆ ProxyFunction()
template<class INSTANCE, typename METHOD, class RETURNOBJ, class ARG1OBJ = Kross::Api::Object, class ARG2OBJ = Kross::Api::Object, class ARG3OBJ = Kross::Api::Object, class ARG4OBJ = Kross::Api::Object>
|
inline |
Member Function Documentation
◆ call()
template<class INSTANCE, typename METHOD, class RETURNOBJ, class ARG1OBJ = Kross::Api::Object, class ARG2OBJ = Kross::Api::Object, class ARG3OBJ = Kross::Api::Object, class ARG4OBJ = Kross::Api::Object>
|
inlinevirtual |
This method got called if the wrapped method should be executed.
- Parameters
-
args The optional list of arguments passed to the execution-call.
- Returns
- The returnvalue of the functioncall. It will be NULL if the functioncall doesn't provide us a returnvalue (e.g. if the function has void as returnvalue).
Implements Kross::Api::Function.
Friends And Related Symbol Documentation
◆ ProxyFunctionCaller
template<class INSTANCE, typename METHOD, class RETURNOBJ, class ARG1OBJ = Kross::Api::Object, class ARG2OBJ = Kross::Api::Object, class ARG3OBJ = Kross::Api::Object, class ARG4OBJ = Kross::Api::Object>
template<class PROXYFUNC, typename RETURNTYPE>
|
friend |
The documentation for this class was generated from the following file:
