Strip namespaces from parameter types
This fixes e.g. li_boost_shared_ptr unit test, which uses Space::Klass that should be known as just Klass (inside the outer namespace) in the generated C++ wrappers.
This commit is contained in:
parent
036e3eb08c
commit
c434b867d7
1 changed files with 8 additions and 0 deletions
|
|
@ -575,6 +575,14 @@ private:
|
||||||
if (Node* const class_node = Language::instance()->classLookup(stripped_type)) {
|
if (Node* const class_node = Language::instance()->classLookup(stripped_type)) {
|
||||||
typestr = SwigType_str(type, 0);
|
typestr = SwigType_str(type, 0);
|
||||||
classname = Getattr(class_node, "sym:name");
|
classname = Getattr(class_node, "sym:name");
|
||||||
|
|
||||||
|
// We don't use namespaces, but the type may contain them, so get rid of them by replacing the base type name, which is fully qualified, with just the
|
||||||
|
// class name, which is not.
|
||||||
|
scoped_dohptr basetype(SwigType_base(type));
|
||||||
|
scoped_dohptr basetypestr(SwigType_str(basetype, 0));
|
||||||
|
if (Cmp(basetypestr, classname) != 0) {
|
||||||
|
Replaceall(typestr, basetypestr, classname);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// This is something unknown, so just use an opaque typedef already declared in C wrappers section for it.
|
// This is something unknown, so just use an opaque typedef already declared in C wrappers section for it.
|
||||||
typestr = NewStringf("SWIGTYPE%s*", SwigType_manglestr(stripped_type));
|
typestr = NewStringf("SWIGTYPE%s*", SwigType_manglestr(stripped_type));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue