Qualify generated SwigDirector class names with namespaces

This commit is contained in:
Brant K. Kyser 2013-01-03 21:26:08 -06:00
commit f6ce5f089f
5 changed files with 55 additions and 38 deletions

View file

@ -855,6 +855,9 @@ int Swig_MethodToFunction(Node *n, const_String_or_char_ptr nspace, String *clas
String *self = 0;
int is_smart_pointer_overload = 0;
String *qualifier = Getattr(n, "qualifier");
String *directorScope = NewString(nspace);
Replace(directorScope, ".", "_", DOH_REPLACE_ANY);
/* If smart pointer without const overload or mutable method, change self dereferencing */
if (flags & CWRAP_SMART_POINTER) {
@ -937,7 +940,7 @@ int Swig_MethodToFunction(Node *n, const_String_or_char_ptr nspace, String *clas
/* If protected access (can only be if a director method) then call the extra public accessor method (language module must provide this) */
String *explicit_qualifier_tmp = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), "qname"));
explicitcall_name = NewStringf("%sSwigPublic", name);
explicit_qualifier = NewStringf("SwigDirector_%s", explicit_qualifier_tmp);
explicit_qualifier = NewStringf("SwigDirector_%s_%s", directorScope, explicit_qualifier_tmp);
Delete(explicit_qualifier_tmp);
} else {
explicit_qualifier = SwigType_namestr(Getattr(Getattr(parentNode(n), "typescope"), "qname"));
@ -1057,6 +1060,7 @@ int Swig_MethodToFunction(Node *n, const_String_or_char_ptr nspace, String *clas
Delete(p);
Delete(self);
Delete(parms);
Delete(directorScope);
return SWIG_OK;
}
@ -1107,6 +1111,9 @@ int Swig_ConstructorToFunction(Node *n, const_String_or_char_ptr nspace, String
ParmList *directorparms;
SwigType *type;
int use_director;
String *directorScope = NewString(nspace);
Replace(directorScope, ".", "_", DOH_REPLACE_ANY);
use_director = Swig_directorclass(n);
@ -1167,7 +1174,7 @@ int Swig_ConstructorToFunction(Node *n, const_String_or_char_ptr nspace, String
Node *parent = Swig_methodclass(n);
int abstract = Getattr(parent, "abstracts") != 0;
String *name = Getattr(parent, "sym:name");
String *directorname = NewStringf("SwigDirector_%s", name);
String *directorname = NewStringf("SwigDirector_%s_%s", directorScope, name);
String *action = NewStringEmpty();
String *tmp_none_comparison = Copy(none_comparison);
String *director_call;
@ -1233,6 +1240,7 @@ int Swig_ConstructorToFunction(Node *n, const_String_or_char_ptr nspace, String
if (directorparms != parms)
Delete(directorparms);
Delete(parms);
Delete(directorScope);
return SWIG_OK;
}