more fixes for '%rename Class' + %copyctor
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9028 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
f07ad7bea8
commit
574ee1af25
2 changed files with 55 additions and 2 deletions
|
|
@ -116,6 +116,39 @@ public:
|
||||||
namespace ABC_Nam {
|
namespace ABC_Nam {
|
||||||
namespace ABC_Libor {
|
namespace ABC_Libor {
|
||||||
struct ModelUtils {};
|
struct ModelUtils {};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct ModelUtils_T {};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%template(ModelUtils_i) ABC_Nam::ABC_Libor::ModelUtils_T<int>;
|
||||||
|
|
||||||
|
|
||||||
|
%rename(Space1Space2_TotalReturnSwap) Space1::Space2::TotalReturnSwap;
|
||||||
|
|
||||||
|
%copyctor;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
namespace Space1 {
|
||||||
|
namespace Space2 {
|
||||||
|
|
||||||
|
class TotalReturnSwap {
|
||||||
|
public:
|
||||||
|
TotalReturnSwap() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class TotalReturnSwap_T {
|
||||||
|
public:
|
||||||
|
TotalReturnSwap_T() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
%template(Total_i) Space1::Space2::TotalReturnSwap_T<int>;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2021,11 +2021,31 @@ static void addCopyConstructor(Node *n)
|
||||||
String *cname = Getattr(n,"name");
|
String *cname = Getattr(n,"name");
|
||||||
SwigType *type = Copy(cname);
|
SwigType *type = Copy(cname);
|
||||||
String *last = Swig_scopename_last(cname);
|
String *last = Swig_scopename_last(cname);
|
||||||
String *name = NewStringf("%s::%s",cname,last);
|
String *name = NewStringf("%s::%s",cname);
|
||||||
String *cc = NewStringf("r.q(const).%s", type);
|
String *cc = NewStringf("r.q(const).%s", type);
|
||||||
String *decl = NewStringf("f(%s).",cc);
|
String *decl = NewStringf("f(%s).",cc);
|
||||||
String *csymname = Getattr(n,"sym:name");
|
String *csymname = Getattr(n,k_symname);
|
||||||
String *oldname = csymname;
|
String *oldname = csymname;
|
||||||
|
|
||||||
|
if (Getattr(n,"allocate:has_constructor")) {
|
||||||
|
// to work properly with '%rename Class', we must look
|
||||||
|
// for any other constructor in the class, which has not been
|
||||||
|
// renamed, and use its name as oldname.
|
||||||
|
Node *c;
|
||||||
|
for (c = firstChild(n); c; c = nextSibling(c)) {
|
||||||
|
const char *tag = Char(nodeType(c));
|
||||||
|
if (strcmp(tag,"constructor") == 0) {
|
||||||
|
String *cname = Getattr(c,k_name);
|
||||||
|
String *csname = Getattr(c,k_symname);
|
||||||
|
String *clast = Swig_scopename_last(cname);
|
||||||
|
if (Equal(csname, clast)) {
|
||||||
|
oldname = csname;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String *symname = Swig_name_make(cn, cname, last, decl, oldname);
|
String *symname = Swig_name_make(cn, cname, last, decl, oldname);
|
||||||
if (!symname) {
|
if (!symname) {
|
||||||
symname = Copy(csymname);
|
symname = Copy(csymname);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue