PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Swig | 81 lines | 61 code | 20 blank | 0 comment | 0 complexity | 4371679d60c160e1cd02215ac9dfdcf6 MD5 | raw file
 1%module extend_typedef_class
 2
 3// classes in global namespace
 4%inline %{
 5  typedef struct tagAClass {
 6    int membervar;
 7  } AClass;
 8
 9  struct BClass {
10    int membervar;
11  };
12
13  typedef struct tagCClass {
14    int membervar;
15  } CClass;
16
17  // Unnamed struct
18  typedef struct {
19    int membervar;
20  } DClass;
21%}
22
23%extend tagAClass {
24  int getvar() { return $self->membervar; }
25}
26
27%extend BClass {
28  int getvar() { return $self->membervar; }
29}
30
31%extend CClass {
32  int getvar() { return $self->membervar; }
33}
34
35%extend DClass {
36  int getvar() { return $self->membervar; }
37}
38
39
40// classes in a namespace
41%inline %{
42namespace Space {
43  typedef struct tagAStruct {
44    int membervar;
45  } AStruct;
46
47  struct BStruct {
48    int membervar;
49  };
50
51  typedef struct tagCStruct {
52    int membervar;
53  } CStruct;
54
55  // Unnamed struct
56  typedef struct {
57    int membervar;
58  } DStruct;
59}
60%}
61
62namespace Space {
63
64%extend tagAStruct {
65  int getvar() { return $self->membervar; }
66}
67
68%extend BStruct {
69  int getvar() { return $self->membervar; }
70}
71
72%extend CStruct {
73  int getvar() { return $self->membervar; }
74}
75
76%extend DStruct {
77  int getvar() { return $self->membervar; }
78}
79
80}
81