Upstream version 1.3.40
[profile/ivi/swig.git] / Examples / test-suite / cpp_typedef.i
1 // This file tests SWIG's tracking of C++ typedef declarations
2
3 %module cpp_typedef
4
5 %{
6
7 class Bar {
8 public:
9 };
10 %}
11
12 %inline %{
13 class Foo {
14 public:
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
28 typedef struct {
29 } UnnamedStruct;
30
31 typedef struct NamedStruct {
32 } TypedefNamedStruct;
33
34 typedef TypedefNamedStruct DoubleTypedef;
35
36 class Test {
37 public:
38     UnnamedStruct test1(UnnamedStruct a) {return a;};
39     struct NamedStruct test2(struct NamedStruct a) {return a;};
40     TypedefNamedStruct test3(TypedefNamedStruct a) {return a;};
41     DoubleTypedef test4(DoubleTypedef a) {return a;};
42 };
43
44 %}
45         
46