aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/multiple_inheritance_overload.i
blob: 237ebd6f12691e47f54b6d57d1b3efca63a9efce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
%module(ruby_minherit="1") multiple_inheritance_overload

%warnfilter(SWIGWARN_D_MULTIPLE_INHERITANCE,
	    SWIGWARN_PHP_MULTIPLE_INHERITANCE); /* languages not supporting multiple inheritance */

#if defined(SWIGJAVA) || defined(SWIGCSHARP)
%include <swiginterface.i>
%interface_impl(Space::Base);
%interface_impl(Space::AnotherBase);
#endif

%ignore AnotherSpace::AnotherBase::AnotherMethod(int i) const;
%ignore Space::Base::Method(int i) const;
%ignore Space::Base::NotVirtualMethod(int i) const;
%ignore Space::Base::SimilarOverloadedMethod(unsigned short i);
%rename(MethodForRenamingConst) Space::Base::MethodForRenaming(int i) const;

// Different overloaded warning filters needed for scripting languages (eg Python) and for statically typed languages (eg C#).
%warnfilter(509, 516) Space::Base::MethodWarningSuppressed(int i) const;

%inline %{
namespace AnotherSpace {
class AnotherBase {
public:
  virtual int AnotherMethod(int i) { return 0; }
  virtual int AnotherMethod(int i) const { return 1; }
  virtual ~AnotherBase() {}
};
}

namespace Space {
class Base
{
public:
  virtual int Method(int i) { return 0; }
  virtual int Method(int i) const { return 1; }
  virtual int MethodForRenaming(int i) { return 0; }
  virtual int MethodForRenaming(int i) const { return 1; }
  virtual int MethodWarningSuppressed(int i) { return 0; }
  virtual int MethodWarningSuppressed(int i) const { return 1; }
  int NotVirtualMethod(int i) { return 0; }
  int NotVirtualMethod(int i) const { return 1; }

  typedef int Integer;

  // int and unsigned short are wrapped with a Java int and so would be automatically ignored with a warning
  virtual int SimilarOverloadedMethod(Integer i) { return 0; }
  virtual int SimilarOverloadedMethod(unsigned short i) { return 1; }
  virtual ~Base() {}
  static Base *in_out(Base *p) { return p; }
};

class Derived : public Base, public AnotherSpace::AnotherBase
{
public:
  int member_var;
};
class MoreDerived : public Derived {
};
}

namespace OtherSpace {
class OtherDerived : public Space::Base
{
};
}
%}