InterfaceScripted.h File Reference
#include "scriptinterface/ScriptInterface.h"
#include "js/jsapi.h"
Go to the source code of this file.
Defines |
| #define | BEGIN_INTERFACE_WRAPPER(iname) |
| #define | END_INTERFACE_WRAPPER(iname) |
| #define | DEFINE_INTERFACE_METHOD_0(scriptname, rettype, classname, methodname) |
| #define | DEFINE_INTERFACE_METHOD_1(scriptname, rettype, classname, methodname, arg1) |
| #define | DEFINE_INTERFACE_METHOD_2(scriptname, rettype, classname, methodname, arg1, arg2) |
| #define | DEFINE_INTERFACE_METHOD_3(scriptname, rettype, classname, methodname, arg1, arg2, arg3) |
| #define | DEFINE_INTERFACE_METHOD_4(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4) |
| #define | DEFINE_INTERFACE_METHOD_5(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4, arg5) |
| #define | DEFINE_INTERFACE_METHOD_6(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4, arg5, arg6) |
Define Documentation
| #define BEGIN_INTERFACE_WRAPPER |
( |
iname |
|
) |
|
Value:JSClass class_ICmp##iname = { \
"ICmp" #iname, JSCLASS_HAS_PRIVATE, \
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub, \
JSCLASS_NO_OPTIONAL_MEMBERS \
}; \
static JSFunctionSpec methods_ICmp##iname[] = {
| #define DEFINE_INTERFACE_METHOD_0 |
( |
scriptname, |
|
|
rettype, |
|
|
classname, |
|
|
methodname |
|
) |
|
Value:{ scriptname, \
ScriptInterface::callMethod<rettype, &class_##classname, classname, &classname::methodname>, \
0, \
JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
| #define DEFINE_INTERFACE_METHOD_1 |
( |
scriptname, |
|
|
rettype, |
|
|
classname, |
|
|
methodname, |
|
|
arg1 |
|
) |
|
Value:{ scriptname, \
ScriptInterface::callMethod<rettype, arg1, &class_##classname, classname, &classname::methodname>, \
1, \
JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
| #define DEFINE_INTERFACE_METHOD_2 |
( |
scriptname, |
|
|
rettype, |
|
|
classname, |
|
|
methodname, |
|
|
arg1, |
|
|
arg2 |
|
) |
|
Value:{ scriptname, \
ScriptInterface::callMethod<rettype, arg1, arg2, &class_##classname, classname, &classname::methodname>, \
2, \
JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
| #define DEFINE_INTERFACE_METHOD_3 |
( |
scriptname, |
|
|
rettype, |
|
|
classname, |
|
|
methodname, |
|
|
arg1, |
|
|
arg2, |
|
|
arg3 |
|
) |
|
Value:{ scriptname, \
ScriptInterface::callMethod<rettype, arg1, arg2, arg3, &class_##classname, classname, &classname::methodname>, \
3, \
JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
| #define DEFINE_INTERFACE_METHOD_4 |
( |
scriptname, |
|
|
rettype, |
|
|
classname, |
|
|
methodname, |
|
|
arg1, |
|
|
arg2, |
|
|
arg3, |
|
|
arg4 |
|
) |
|
Value:{ scriptname, \
ScriptInterface::callMethod<rettype, arg1, arg2, arg3, arg4, &class_##classname, classname, &classname::methodname>, \
4, \
JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
| #define DEFINE_INTERFACE_METHOD_5 |
( |
scriptname, |
|
|
rettype, |
|
|
classname, |
|
|
methodname, |
|
|
arg1, |
|
|
arg2, |
|
|
arg3, |
|
|
arg4, |
|
|
arg5 |
|
) |
|
Value:{ scriptname, \
ScriptInterface::callMethod<rettype, arg1, arg2, arg3, arg4, arg5, &class_##classname, classname, &classname::methodname>, \
5, \
JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
| #define DEFINE_INTERFACE_METHOD_6 |
( |
scriptname, |
|
|
rettype, |
|
|
classname, |
|
|
methodname, |
|
|
arg1, |
|
|
arg2, |
|
|
arg3, |
|
|
arg4, |
|
|
arg5, |
|
|
arg6 |
|
) |
|
Value:{ scriptname, \
ScriptInterface::callMethod<rettype, arg1, arg2, arg3, arg4, arg5, arg6, &class_##classname, classname, &classname::methodname>, \
6, \
JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT },
| #define END_INTERFACE_WRAPPER |
( |
iname |
|
) |
|
Value:{ NULL } \
}; \
void ICmp##iname::InterfaceInit(ScriptInterface& scriptInterface) { \
JSContext* cx = scriptInterface.GetContext(); \
JSObject* global = JS_GetGlobalObject(cx); \
JS_InitClass(cx, global, NULL, &class_ICmp##iname, NULL, 0, NULL, methods_ICmp##iname, NULL, NULL); \
} \
JSClass* ICmp##iname::GetJSClass() const { return &class_ICmp##iname; } \
void RegisterComponentInterface_##iname(ScriptInterface& scriptInterface) { \
ICmp##iname::InterfaceInit(scriptInterface); \
}