summaryrefslogtreecommitdiff
path: root/Examples/test-suite/director_using_member_scopes.i
blob: d2776ea1eca60cbb56bfeccc79121de53e5770fd (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
%module(directors="1") director_using_member_scopes

// Similar to using_member_scopes but for directors

#if !defined(SWIGGO) // TODO: fix Go crash

%feature("director");
// Python,Java,C# no diffs in generated code when adding in nodirector. Go not happy even without %nodirector.
// 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

// Github issue #1441 - segfault in Go and C#

%inline %{
namespace OgreBites
{
    struct NativeWindowType {};
    class ApplicationContextBase {
    public:
        virtual ~ApplicationContextBase() {}
        virtual int setWindowGrab(NativeWindowType* win, bool grab = true) { return 0; }
        int setWindowGrab(bool grab = true) { return 5; }

        static int call_setWindowGrab(ApplicationContextBase* ptr, NativeWindowType* win, bool grab) { return ptr->setWindowGrab(win, grab); }
    };
    class ApplicationContextSDL : public ApplicationContextBase {
    public:
        using ApplicationContextBase::setWindowGrab;
        int setWindowGrab(NativeWindowType* win, bool grab = true) { return 10; } // This should not be added again as it exists in base class

        static int call_setWindowGrab(ApplicationContextSDL* ptr, NativeWindowType* win, bool grab) { return ptr->setWindowGrab(win, grab); }
    };

    class ACB {
    public:
        virtual ~ACB() {}
        virtual int setWindowGrab(NativeWindowType* win, bool grab = true) { return 0; }
        virtual int setWindowGrab(const char *s, int val) { return 1; } // Additional method compared to ApplicationContextBase
        int setWindowGrab(bool grab = true) { return 5; }

        static int call_setWindowGrab(ACB* ptr, NativeWindowType* win, bool grab) { return ptr->setWindowGrab(win, grab); }
        static int call_setWindowGrab(ACB* ptr, const char *s, int val) { return ptr->setWindowGrab(s, val); }
    };
    class ACSDL : public ACB {
    public:
        using ACB::setWindowGrab; // This introduces two methods, not one method like ApplicationContextSDL
        int setWindowGrab(NativeWindowType* win, bool grab = true) { return 10; } // This should not be added again as it exists in base class

        static int call_setWindowGrab(ACSDL* ptr, NativeWindowType* win, bool grab) { return ptr->setWindowGrab(win, grab); }
        static int call_setWindowGrab(ACSDL* ptr, const char *s, int val) { return ptr->setWindowGrab(s, val); }
    };
}
%}

#endif