add/fix protected/private bases + template
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6747 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
590c322f99
commit
56e38db2de
2 changed files with 49 additions and 7 deletions
|
|
@ -21,4 +21,42 @@ public:
|
|||
Spam() { }
|
||||
};
|
||||
|
||||
|
||||
template <class Type>
|
||||
class NRFilter {
|
||||
public:
|
||||
virtual ~NRFilter()
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void do_filter() = 0;
|
||||
};
|
||||
|
||||
template <class Type>
|
||||
class NRRCFilter : public NRFilter<Type>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
template <class Type>
|
||||
class NRRCFilterpro : protected NRFilter<Type>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
template <class Type>
|
||||
class NRRCFilterpri : private NRFilter<Type>
|
||||
{
|
||||
};
|
||||
|
||||
%}
|
||||
|
||||
%template(NRFilter_i) NRFilter<int>;
|
||||
|
||||
%template(NRRCFilter_i) NRRCFilter<int>;
|
||||
|
||||
%template(NRRCFilterpro_i) NRRCFilterpro<int>;
|
||||
|
||||
%template(NRRCFilterpri_i) NRRCFilterpri<int>;
|
||||
|
||||
|
|
|
|||
|
|
@ -92,13 +92,17 @@ cparse_template_expand(Node *n, String *tname, String *rname, String *templatear
|
|||
} else if (Strcmp(nodeType(n),"class") == 0) {
|
||||
/* Patch base classes */
|
||||
{
|
||||
List *bases = Getattr(n,"baselist");
|
||||
if (bases) {
|
||||
int i;
|
||||
for (i = 0; i < Len(bases); i++) {
|
||||
String *name = Copy(Getitem(bases,i));
|
||||
Setitem(bases,i,name);
|
||||
Append(typelist,name);
|
||||
char *baselists[] = {"baselist","protectedbaselist","privatebaselist"};
|
||||
int b = 0;
|
||||
for (b = 0; b < 3; ++b) {
|
||||
List *bases = Getattr(n,baselists[b]);
|
||||
if (bases) {
|
||||
int i;
|
||||
for (i = 0; i < Len(bases); i++) {
|
||||
String *name = Copy(Getitem(bases,i));
|
||||
Setitem(bases,i,name);
|
||||
Append(typelist,name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue