Fix STL wrappers to not generate <: digraphs.

For example std::vector<::X::Y> was sometimes generated, now
corrected to std::vector< ::X::Y >.
This commit is contained in:
William S Fulton 2015-12-12 14:05:05 +00:00
commit 6b4e57245d
33 changed files with 339 additions and 303 deletions

View file

@ -72,7 +72,7 @@ namespace std {
%}
%fragment("StdTraitsCommon","header",fragment="<string>") %{
namespace swig {
namespace swig {
template <class Type>
struct noconst_traits {
typedef Type noconst_type;
@ -86,7 +86,7 @@ namespace swig {
/*
type categories
*/
struct pointer_category { };
struct pointer_category { };
struct value_category { };
/*
@ -99,12 +99,12 @@ namespace swig {
return traits<typename noconst_traits<Type >::noconst_type >::type_name();
}
template <class Type>
template <class Type>
struct traits_info {
static swig_type_info *type_query(std::string name) {
name += " *";
return SWIG_TypeQuery(name.c_str());
}
}
static swig_type_info *type_info() {
static swig_type_info *info = type_query(type_name<Type>());
return info;
@ -125,22 +125,22 @@ namespace swig {
std::string ptrname = name;
ptrname += " *";
return ptrname;
}
}
static const char* type_name() {
static std::string name = make_ptr_name(swig::type_name<Type>());
return name.c_str();
}
};
template <class Type, class Category>
template <class Type, class Category>
struct traits_as { };
template <class Type, class Category>
template <class Type, class Category>
struct traits_check { };
}
%}
/*
Generate the traits for a swigtype
*/
@ -148,7 +148,7 @@ namespace swig {
%define %traits_swigtype(Type...)
%fragment(SWIG_Traits_frag(Type),"header",fragment="StdTraits") {
namespace swig {
template <> struct traits<Type > {
template <> struct traits< Type > {
typedef pointer_category category;
static const char* type_name() { return #Type; }
};
@ -164,7 +164,7 @@ namespace swig {
%define %typemap_traits(Code,Type...)
%typemaps_asvalfrom(%arg(Code),
%arg(swig::asval<Type >),
%arg(swig::asval< Type >),
%arg(swig::from),
%arg(SWIG_Traits_frag(Type)),
%arg(SWIG_Traits_frag(Type)),
@ -194,10 +194,10 @@ namespace swig {
bool operator == (const Type& v) {
return *self == v;
}
bool operator != (const Type& v) {
return *self != v;
}
}
}
%enddef
@ -211,7 +211,7 @@ namespace swig {
bool operator > (const Type& v) {
return *self > v;
}
bool operator < (const Type& v) {
return *self < v;
}