more smart_pointer + static methods fixes

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6915 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-12-23 01:12:07 +00:00
commit ba413fd500
3 changed files with 45 additions and 4 deletions

View file

@ -69,3 +69,29 @@
};
%}
%extend CFoo
{
public:
static void StatFun() {};
static void StatFun(int i) {};
static void HoHoHo(int i, int j) {};
}
%inline %{
class CFoo
{
};
class CPtrFoo
{
public:
CFoo* operator->(void) {return 0;};
};
%}

View file

@ -1101,6 +1101,10 @@ Language::staticmemberfunctionHandler(Node *n) {
Delete(mrename);
mrename = mangled;
if (Getattr(n,"sym:overloaded") && code) {
Append(cname, Getattr(defaultargs ? defaultargs : n,"sym:overname"));
}
if (!defaultargs && code) {
/* Hmmm. An added static member. We have to create a little wrapper for this */
Swig_add_extension_code(n, cname, parms, type, code, CPlusPlus);

View file

@ -791,16 +791,27 @@ Swig_MethodToFunction(Node *n, String *classname, int flags) {
if (flags & CWRAP_SMART_POINTER) {
int i = 0;
Parm *pp = p;
String *func = NewStringf("%s((%s*)(%s)->operator ->()", mangled, cname,
Swig_cparm_name(pp,i++));
while ((pp = nextSibling(pp))) {
String *func = NewStringf("%s(", mangled);
if (Cmp(Getattr(n,"storage"),"static") != 0) {
String *fadd = NewStringf("(%s*)(%s)->operator ->()", cname, Swig_cparm_name(pp,i));
Append(func,fadd);
Delete(fadd);
pp = nextSibling(pp);
if (pp) Append(func,",");
} else{
pp = nextSibling(pp);
}
++i;
while (pp) {
SwigType *pt = Getattr(pp,"type");
if ((SwigType_type(pt) != T_VOID)) {
String *pname = Swig_cparm_name(pp,i++);
String *rcaststr = SwigType_rcaststr(pt, pname);
Printf(func,",%s", rcaststr);
Printf(func,"%s", rcaststr);
Delete(rcaststr);
Delete(pname);
pp = nextSibling(pp);
if (pp) Append(func,",");
}
}
Printf(func,")");