PageRenderTime 21ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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

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