more valuewrapper cases

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6380 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-10-08 20:32:20 +00:00
commit ae673f007b
2 changed files with 17 additions and 3 deletions

View file

@ -28,6 +28,15 @@ public:
%feature("novaluewrapper") B; %feature("novaluewrapper") B;
class B; class B;
/*
* Force swig to use the value wrapper, even when the class
* has a default constructor, in case you want to save a
* instance construction.
*
*/
%feature("valuewrapper") D;
class D;
%inline %{ %inline %{
@ -37,6 +46,8 @@ public:
A(int){} A(int){}
}; };
class D {};
class Klass {}; class Klass {};
@ -91,6 +102,10 @@ B getB(B a) {
return a; return a;
} }
D getD(D a) {
return a;
}
%} %}
%template() auto_ptr<A>; %template() auto_ptr<A>;

View file

@ -359,9 +359,8 @@ SwigType *cplus_value_type(SwigType *t) {
if (((Strcmp(nodeType(n),"class") == 0) if (((Strcmp(nodeType(n),"class") == 0)
&& !Getattr(n,"allocate:noassign") && !Getattr(n,"allocate:noassign")
&& (Getattr(n,"allocate:default_constructor"))) && (Getattr(n,"allocate:default_constructor")))
|| (Getattr(n,"feature:novaluewrapper") || (Getattr(n,"feature:novaluewrapper"))) {
&& !Getattr(n,"feature:valuewrapper"))) { use_wrapper = Getattr(n,"feature:valuewrapper") ? 1 : 0;
use_wrapper = 0;
} }
} }
Delete(ftd); Delete(ftd);