Commit e8ba822b authored by jhammen's avatar jhammen
Browse files

api interface external resolve methods

parent 37664915
......@@ -15,10 +15,15 @@ namespace binding {
{{interface.qname}} *get{{interface.package.name}}{{interface.name}}(HSQUIRRELVM &vm, int index) {
SQUserPointer ptr;
{{interface.subclasses type}}
if (!SQ_FAILED(sq_getinstanceup(vm, index, (SQUserPointer*)&ptr, &{{type.package.name}}{{type.name}}Object))) {
if (!SQ_FAILED(sq_getinstanceup(vm, index, &ptr, &{{type.package.name}}{{type.name}}Object))) {
return static_cast<{{type.qname}} *>(ptr);
}
{{/interface.subclasses}}
{{interface.resolve ?}}
if (!SQ_FAILED(sq_getinstanceup(vm, index, &ptr, nullptr))) {
return resolve_{{interface.package.name.tolower}}{{interface.name.tolower}}(ptr);
}
{{/interface.resolve}}
return nullptr;
}
......
......@@ -25,6 +25,13 @@ namespace binding
{{interface.returns ?}}
void push{{interface.package.name}}{{interface.name}}(HSQUIRRELVM &vm, {{interface.qname}} *obj);
{{/interface.returns}}
{{/interfaces}}
// resolve methods - implemented elsewhere
{{interfaces interface}}
{{interface.resolve ?}}
{{interface.qname}} *resolve_{{interface.package.name.tolower}}{{interface.name.tolower}}(SQUserPointer obj);
{{/interface.resolve}}
{{/interfaces}}
}
}
......
......@@ -549,6 +549,7 @@ class Class extends Type {
class Interface extends Class {
subclasses = null
returns = false
resolve = false
function init(pack) {
this.package = pack
foreach(def in methods) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment