fix template + enum issue reported by James Bigler
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9018 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
99eb0abe1f
commit
23d9abf135
3 changed files with 42 additions and 1 deletions
|
|
@ -13,3 +13,29 @@ public:
|
||||||
%template(foo_i) foo<int>;
|
%template(foo_i) foo<int>;
|
||||||
%template(foo_d) foo<double>;
|
%template(foo_d) foo<double>;
|
||||||
|
|
||||||
|
|
||||||
|
%inline {
|
||||||
|
|
||||||
|
namespace Manta {
|
||||||
|
template<typename Traits> class ColorSpace {
|
||||||
|
public:
|
||||||
|
typedef typename Traits::ComponentType ComponentType;
|
||||||
|
enum { NumComponents = Traits::NumComponents};
|
||||||
|
|
||||||
|
ComponentType data[NumComponents];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Manta {
|
||||||
|
class RGBTraits {
|
||||||
|
public:
|
||||||
|
typedef float ComponentType;
|
||||||
|
enum {NumComponents = 3};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
namespace Manta {
|
||||||
|
%template(Color) ColorSpace<RGBTraits>;
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -1415,6 +1415,11 @@ Swig_symbol_type_qualify(const SwigType *t, Symtab *st) {
|
||||||
List *elements;
|
List *elements;
|
||||||
String *result = NewStringEmpty();
|
String *result = NewStringEmpty();
|
||||||
int i,len;
|
int i,len;
|
||||||
|
char *c = Char(t);
|
||||||
|
if (strncmp(c,"::",2) == 0) {
|
||||||
|
StringAppend(result, t);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
elements = SwigType_split(t);
|
elements = SwigType_split(t);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -595,7 +595,17 @@ SwigType_array_getdim(SwigType *t, int n) {
|
||||||
c++;
|
c++;
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
if (n == 0) return SwigType_parm(c);
|
if (n == 0) {
|
||||||
|
String *dim = SwigType_parm(c);
|
||||||
|
if (SwigType_istemplate(dim)) {
|
||||||
|
String *ndim = SwigType_namestr(dim);
|
||||||
|
Delete(dim);
|
||||||
|
dim = ndim;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dim;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue