Fix wrapping of char * member variables (or any types with a memberin typemap) when using allprotected mode.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10431 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-05-09 21:41:46 +00:00
commit efa0db04c6
3 changed files with 9 additions and 3 deletions

View file

@ -1,6 +1,10 @@
Version 1.3.36 (in progress)
=============================
05/09/2008: wsfulton
Fix wrapping of char * member variables when using allprotected mode.
Bug reported by Warren Wang.
05/09/2008: olly
[PHP] Fix bad PHP code generated when wrapping an enum in a
namespace (uncovered by testcase arrays_scope).

View file

@ -28,7 +28,7 @@ class PublicBase {
public:
enum AnEnum { EnumVal1, EnumVal2 };
public:
PublicBase(const char* s): str(s) {}
PublicBase(const char* s): str(s), instanceMemberVariable(0), anEnum(EnumVal1), stringMember(0) {}
virtual ~PublicBase() { }
virtual std::string virtualMethod() const { return "PublicBase"; }
Klass instanceMethod(Klass k) const { return k; }
@ -41,6 +41,7 @@ public:
static int staticMemberVariable;
static const int staticConstMemberVariable = 20;
AnEnum anEnum;
char *stringMember;
};
int PublicBase::staticMemberVariable = 10;
@ -50,7 +51,7 @@ public:
enum AnEnum { EnumVal1, EnumVal2 };
std::string getName() { return str; }
protected:
ProtectedBase(const char* s): str(s) {}
ProtectedBase(const char* s): str(s), instanceMemberVariable(0), anEnum(EnumVal1), stringMember(0), protectedenum(ProtEnumVal1) {}
virtual ~ProtectedBase() { }
virtual std::string virtualMethod() const { return "ProtectedBase"; }
Klass instanceMethod(Klass k) const { return k; }
@ -63,6 +64,7 @@ protected:
static int staticMemberVariable;
static const int staticConstMemberVariable = 20;
AnEnum anEnum;
char *stringMember;
// unsupported: types defined with protected access and thus methods/variables which use them
enum ProtectedEnum { ProtEnumVal1, ProtEnumVal2 };

View file

@ -1428,7 +1428,7 @@ int Language::membervariableHandler(Node *n) {
Delete(pname);
}
} else {
String *pname = Swig_cparm_name(0, 0);
String *pname = is_non_virtual_protected_access(n) ? NewString("darg") : Swig_cparm_name(0, 0);
target = NewStringf("%s->%s", pname, name);
Delete(pname);
}