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

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

#
Swig | 51 lines | 42 code | 9 blank | 0 comment | 0 complexity | ce53a8a23ed94a97b77c31322d693801 MD5 | raw file
 1%module smart_pointer_templatemethods
 2
 3%inline %{
 4namespace ns {
 5 
 6template <typename T>
 7class Ptr
 8{
 9public:
10  Ptr () {}
11  T *operator -> () { return 0; }
12};
13 
14typedef unsigned short uint16_t;
15class InterfaceId
16{
17public:
18  InterfaceId (uint16_t iid) {}
19  InterfaceId() {}
20};
21 
22template <typename K> class Objekt
23{
24public:
25  Objekt () {}
26  virtual ~Objekt () {}
27  Ptr<K> QueryInterface (InterfaceId iid) const { return Ptr<K>(); }
28  void DisposeObjekt (void) {}
29};
30
31class Objct
32{
33public:
34  Objct () {}
35  virtual ~Objct () {}
36  template <typename T> Ptr<T> QueryInterface (InterfaceId iid) const { return Ptr<T>(); }
37  void DisposeObjct (void) {}
38};
39 
40#ifdef SWIG
41%template(PtrObjct) Ptr<Objct>;
42%template(PtrInt) Ptr<int>;
43%template(ObjektInt) Objekt<int>;
44%template(PtrObjektInt) Ptr<Objekt<int> >;
45%template(QueryInterfaceObjct) Objct::QueryInterface<Objct>;
46#endif
47
48}; // namespace
49 
50%}
51