PageRenderTime 32ms CodeModel.GetById 28ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/rel-1-3-26/SWIG/Examples/test-suite/director_detect.i

#
Swig | 67 lines | 47 code | 20 blank | 0 comment | 0 complexity | cf562867880f6a6e073792ac81370cf1 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
 1%module(directors="1") director_detect
 2
 3%warnfilter(822, 842) cloner; /* Java, C# covariant return types */
 4
 5%{
 6#include <string>
 7#include <iostream>
 8%}
 9
10%include "std_string.i"
11
12%feature("director") Bar;
13
14%newobject Foo::cloner();
15%newobject Bar::cloner();
16
17
18%inline {
19  namespace foo { typedef int Int; }
20  
21  struct A
22  {
23  };
24  
25  typedef A B;
26  
27  struct Foo {
28    virtual ~Foo() {}
29    virtual Foo* cloner() = 0;
30    virtual int get_value() = 0;
31    virtual A* get_class() = 0;
32
33    virtual void just_do_it() = 0;
34  };
35  
36  class Bar : public Foo
37  {
38  public:    
39    Foo* baseclass() 
40    {
41      return this;
42    }    
43    
44    Bar* cloner()
45    {
46      return new Bar();
47    }
48    
49    
50    foo::Int get_value() 
51    {
52      return 1;
53    }
54
55    B* get_class() 
56    {
57      return new B();
58    }
59
60    void just_do_it() 
61    {
62    }
63  };  
64}
65
66
67