aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/using_member_scopes.i
blob: 3245c9cc764dff0d7645a655cf6cd227539908c8 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
%module using_member_scopes

// Fully qualifying parameter types in a method declared after the using declaration caused
// a method being incorrectly added by the using declaration even though the declaration already existed

%inline %{
namespace OgreBites
{
    struct NativeWindowType {};
    class ApplicationContextBase {
    public:
        virtual ~ApplicationContextBase() {}
        virtual void setWindowGrab(NativeWindowType* win, bool grab = true) {}
        void setWindowGrab(bool grab = true) {}
    };
    class ApplicationContextSDL : public ApplicationContextBase {
    public:
        using ApplicationContextBase::setWindowGrab;
        void setWindowGrab(NativeWindowType* win, bool grab = true) {} // This should not be added again as it exists in base class
    };
/*
typedef not working yet
    class ApplicationContextSDL2 : public ApplicationContextBase {
    public:
        using ApplicationContextBase::setWindowGrab;
        typedef NativeWindowType* pNWT;
        void setWindowGrab(pNWT win, bool grab) {} // This should not be added again as it exists in base class
    };
*/
}
%}


%inline %{
// Test using declaration in various positions before and after overloaded methods
// Testing where the derived class overrides all the base class methods (and more)
namespace Bites
{
  struct Base
  {
    virtual ~Base() {}
    virtual void grab() {}
    virtual void grab(int i) {}
  };
  struct Derived1 : public Base
  {
    using Base::grab;
    virtual void grab() {}
    virtual void grab(int i) {}
  };
  struct Derived2 : public Base
  {
    using Base::grab;
    virtual void grab() {}
    virtual void grab(int i) {}
    virtual void grab(int i, double d) {}
  };
  struct Derived3 : public Base
  {
    virtual void grab() {}
    using Base::grab;
    virtual void grab(int i) {}
  };
  struct Derived4 : public Base
  {
    virtual void grab() {}
    using Base::grab;
    virtual void grab(int i) {}
    virtual void grab(int i, double d) {}
  };
  struct Derived5 : public Base
  {
    virtual void grab() {}
    virtual void grab(int i) {}
    using Base::grab;
  };
  struct Derived6 : public Base
  {
    virtual void grab() {}
    virtual void grab(int i) {}
    virtual void grab(int i, double d) {}
    using Base::grab;
  };
}
%}