PageRenderTime 14ms CodeModel.GetById 11ms app.highlight 0ms RepoModel.GetById 2ms app.codeStats 0ms

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

#
Swig | 40 lines | 27 code | 13 blank | 0 comment | 0 complexity | da9eee0cc20321edd49ec99023af2402 MD5 | raw file
 1// This file tests SWIG pass/return by value for
 2// a class with no default constructor
 3
 4%module cpp_nodefault
 5
 6%inline %{
 7
 8class Foo {
 9public:
10   int a;
11   Foo(int x, int y) { }
12  ~Foo() {}
13};
14
15Foo create(int x, int y) {
16    return Foo(x,y);
17}
18
19typedef Foo Foo_t;
20
21void consume(Foo f, Foo_t g) {}
22
23class Bar {
24public:
25    void consume(Foo f, Foo_t g) {}
26    Foo create(int x, int y) {
27        return Foo(x,y);
28    }
29};
30
31
32%}
33
34%{
35Foo gvar = Foo(3,4);
36%}
37
38Foo gvar;
39
40