import source from 1.3.40
[external/swig.git] / Examples / test-suite / smart_pointer_templatemethods.i
1
2 %module smart_pointer_templatemethods
3
4 %inline %{
5 namespace ns {
6  
7 template <typename T>
8 class Ptr
9 {
10 public:
11   Ptr () {}
12   T *operator -> () { return 0; }
13 };
14  
15 typedef unsigned short uint16_t;
16 class InterfaceId
17 {
18 public:
19   InterfaceId (uint16_t iid) {}
20   InterfaceId() {}
21 };
22  
23 template <typename K> class Objekt
24 {
25 public:
26   Objekt () {}
27   virtual ~Objekt () {}
28   Ptr<K> QueryInterface (InterfaceId iid) const { return Ptr<K>(); }
29   void DisposeObjekt (void) {}
30 };
31
32 class Object
33 {
34 public:
35   Object () {}
36   virtual ~Object () {}
37   template <typename T> Ptr<T> QueryInterface (InterfaceId iid) const { return Ptr<T>(); }
38   void DisposeObject (void) {}
39 };
40  
41 #ifdef SWIG
42 %template(PtrObject) Ptr<Object>;
43 %template(PtrInt) Ptr<int>;
44 %template(ObjektInt) Objekt<int>;
45 %template(PtrObjektInt) Ptr<Objekt<int> >;
46 %template(QueryInterfaceObject) Object::QueryInterface<Object>;
47 #endif
48
49 }; // namespace
50  
51 %}
52