PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/multiple_inheritance.i

#
Swig | 94 lines | 74 code | 18 blank | 2 comment | 0 complexity | 4142d62e6da7c3653840f6aa4df2fb22 MD5 | raw file
 1/* This was broken in the perl module.  See bug 962115 
 2It tests basic multiple inheritance */
 3
 4%module(ruby_minherit="1") multiple_inheritance
 5
 6%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE,
 7	    SWIGWARN_CSHARP_MULTIPLE_INHERITANCE,
 8	    SWIGWARN_D_MULTIPLE_INHERITANCE,
 9	    SWIGWARN_PHP_MULTIPLE_INHERITANCE) FooBar;	/* C#, D, Java, PHP multiple inheritance */
10
11%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE,
12	    SWIGWARN_CSHARP_MULTIPLE_INHERITANCE,
13	    SWIGWARN_D_MULTIPLE_INHERITANCE,
14	    SWIGWARN_PHP_MULTIPLE_INHERITANCE) FooBarSpam;	/* C#, D, Java, PHP multiple inheritance */
15
16
17%inline %{
18
19class Bar {
20public:
21  virtual ~Bar()
22  {
23  }
24  
25  virtual int bar() { return 1; }
26};
27
28class Foo {
29public:
30  virtual ~Foo()
31  {
32  }
33
34  virtual int foo() { return 2; }
35};
36
37template<class T> class Spam {
38public:
39  virtual ~Spam()
40  {
41  }
42  
43  virtual int spam(const T& t) { return 100; }
44};
45%}
46
47%template(SpamInt) Spam<int>;
48
49%inline %{
50class FooBar : public Foo, public Bar {
51public:
52  virtual int fooBar() { return 3; }
53};
54
55class FooBarSpam : public Foo, public Bar, public Spam<int> {
56public:
57  virtual int fooBarSpam() { return 4; }
58};
59
60%}
61
62// Languages that don't support multiple inheritance should inherit from one of the non-ignored classes
63%ignore IgnoreMe;
64%ignore IgnoreMeToo;
65
66%inline %{
67class IgnoreMe {
68public:
69  virtual int ignoreme() { return 5; }
70  virtual ~IgnoreMe() {}
71};
72class IgnoreMeToo {
73public:
74  virtual int ignoremetoo() { return 6; }
75  virtual ~IgnoreMeToo() {}
76};
77class IgnoreDerived1 : public IgnoreMe, public Bar {
78public:
79  virtual int ignorederived1() { return 7; }
80};
81class IgnoreDerived2 : public IgnoreMe, public IgnoreMeToo, public Bar {
82public:
83  virtual int ignorederived2() { return 8; }
84};
85class IgnoreDerived3 : public IgnoreMe, public Bar, public IgnoreMeToo {
86public:
87  virtual int ignorederived3() { return 9; }
88};
89class IgnoreDerived4 : public Bar, public IgnoreMe, public IgnoreMeToo {
90public:
91  virtual int ignorederived4() { return 10; }
92};
93%}
94