PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Swig | 50 lines | 39 code | 11 blank | 0 comment | 0 complexity | 785c624dce1f77a1af3bdec18b3d0e3a MD5 | raw file
 1// This file tests SWIG's tracking of C++ typedef declarations
 2
 3%module cpp_typedef
 4
 5%{
 6
 7class Bar {
 8public:
 9};
10%}
11
12%inline %{
13class Foo {
14public:
15    typedef Bar SomeBar;
16    typedef SomeBar SomeOtherBar;
17    SomeOtherBar bar() {
18        SomeOtherBar b;
19        return b;
20    }
21    static SomeOtherBar sbar() {
22        SomeOtherBar b;
23        return b;
24    }
25};
26
27// Test that the correct types are used for typedef struct declarations
28typedef struct {
29  int something;
30  void m() {}
31} UnnamedStruct;
32
33typedef struct NamedStruct {
34  int something;
35  void m() {}
36} TypedefNamedStruct;
37
38typedef TypedefNamedStruct DoubleTypedef;
39
40class Test {
41public:
42    UnnamedStruct test1(UnnamedStruct a) {return a;};
43    struct NamedStruct test2(struct NamedStruct a) {return a;};
44    TypedefNamedStruct test3(TypedefNamedStruct a) {return a;};
45    DoubleTypedef test4(DoubleTypedef a) {return a;};
46};
47
48%}
49        
50