fixes for director class naming when nested classes are used
This commit is contained in:
parent
504c2030bb
commit
e18044185e
7 changed files with 67 additions and 47 deletions
|
|
@ -284,6 +284,7 @@ CPP_TEST_CASES += \
|
|||
naturalvar_more \
|
||||
naturalvar_onoff \
|
||||
nested_class \
|
||||
nested_directors \
|
||||
nested_comment \
|
||||
nested_scope \
|
||||
nested_workaround \
|
||||
|
|
|
|||
20
Examples/test-suite/csharp/nested_directors_runme.cs
Normal file
20
Examples/test-suite/csharp/nested_directors_runme.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using nested_directorsNamespace;
|
||||
#pragma warning disable 219
|
||||
|
||||
public class CNested : Base.Nest {
|
||||
public override bool GetValue() {return true;}
|
||||
}
|
||||
public class CSub : Sub {
|
||||
protected override bool GetValue() { return base.GetValue(); }
|
||||
public bool Test(){ return GetValue(); }
|
||||
}
|
||||
|
||||
public class runme {
|
||||
static void Main() {
|
||||
CNested n = new CNested();
|
||||
CSub s = new CSub();
|
||||
if (!s.Test())
|
||||
throw new Exception("Sub.GetValue");
|
||||
}
|
||||
}
|
||||
35
Examples/test-suite/nested_directors.i
Normal file
35
Examples/test-suite/nested_directors.i
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
%module(directors="1", allprotected="1") nested_directors
|
||||
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Base::Nest;
|
||||
%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Sub::IListener;
|
||||
|
||||
%feature("director") Base;
|
||||
%feature("director") Sub;
|
||||
%feature("director") Base::Nest;
|
||||
|
||||
%inline %{
|
||||
namespace NN {
|
||||
class Base {
|
||||
public:
|
||||
virtual ~Base(){}
|
||||
class Nest {
|
||||
public:
|
||||
virtual ~Nest(){}
|
||||
virtual bool GetValue(){ return false; }
|
||||
};
|
||||
protected:
|
||||
virtual bool DoNothing() = 0;
|
||||
};
|
||||
|
||||
class Sub : public Base {
|
||||
public:
|
||||
class IListener {
|
||||
};
|
||||
public:
|
||||
virtual ~Sub(){}
|
||||
protected:
|
||||
void DoSomething(){}
|
||||
virtual bool GetValue() const { return true; }
|
||||
};
|
||||
}
|
||||
%}
|
||||
Loading…
Add table
Add a link
Reference in a new issue