fix/apply naturalvar
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8605 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
d731d23397
commit
a4b8f2cb27
7 changed files with 22 additions and 8 deletions
|
|
@ -1,7 +1,12 @@
|
||||||
%module li_std_string
|
%module li_std_string
|
||||||
|
|
||||||
|
%naturalvar;
|
||||||
|
|
||||||
|
|
||||||
%include <std_basic_string.i>
|
%include <std_basic_string.i>
|
||||||
%include <std_string.i>
|
%include <std_string.i>
|
||||||
|
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
|
||||||
struct A : std::string
|
struct A : std::string
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,11 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
%naturalvar basic_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
%std_comp_methods(basic_string<char>);
|
%std_comp_methods(basic_string<char>);
|
||||||
|
%naturalvar string;
|
||||||
typedef basic_string<char> string;
|
typedef basic_string<char> string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
%std_comp_methods(basic_string<wchar_t>);
|
%std_comp_methods(basic_string<wchar_t>);
|
||||||
|
%naturalvar wstring;
|
||||||
typedef basic_string<wchar_t> wstring;
|
typedef basic_string<wchar_t> wstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
//
|
//
|
||||||
// String
|
// String
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#ifndef SWIG_STD_BASIC_STRING
|
#ifndef SWIG_STD_BASIC_STRING
|
||||||
#define SWIG_STD_STRING
|
#define SWIG_STD_STRING
|
||||||
|
|
||||||
|
|
@ -12,6 +14,7 @@
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
|
%naturalvar string;
|
||||||
class string;
|
class string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
|
%naturalvar wstring;
|
||||||
class wstring;
|
class wstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -386,14 +386,12 @@ int use_naturalvar_mode(Node *n) {
|
||||||
/* look for feature in the class */
|
/* look for feature in the class */
|
||||||
SwigType *ty = Getattr(n,"type");
|
SwigType *ty = Getattr(n,"type");
|
||||||
if (SwigType_isclass(ty)) {
|
if (SwigType_isclass(ty)) {
|
||||||
SwigType *rty = SwigType_typedef_resolve_all(ty);
|
Node *m = Copy(n);
|
||||||
SwigType *qty = SwigType_typedef_qualified(rty);
|
SwigType *tys = SwigType_strip_qualifiers(ty);
|
||||||
Node *cn = classhash ? Getattr(classhash,qty) : 0;
|
Swig_features_get(Swig_cparse_features(), 0, tys, 0, m);
|
||||||
if (cn) {
|
nvar = GetFlag(m,"feature:naturalvar");
|
||||||
nvar = GetFlag(cn,"feature:naturalvar");
|
Delete(tys);
|
||||||
}
|
Delete(m);
|
||||||
Delete(rty);
|
|
||||||
Delete(qty);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nvar ? CWRAP_NATURAL_VAR : 0;
|
return nvar ? CWRAP_NATURAL_VAR : 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue