PageRenderTime 36ms CodeModel.GetById 16ms 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
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module smart_pointer_templatemethods
  2. %inline %{
  3. namespace ns {
  4. template <typename T>
  5. class Ptr
  6. {
  7. public:
  8. Ptr () {}
  9. T *operator -> () { return 0; }
  10. };
  11. typedef unsigned short uint16_t;
  12. class InterfaceId
  13. {
  14. public:
  15. InterfaceId (uint16_t iid) {}
  16. InterfaceId() {}
  17. };
  18. template <typename K> class Objekt
  19. {
  20. public:
  21. Objekt () {}
  22. virtual ~Objekt () {}
  23. Ptr<K> QueryInterface (InterfaceId iid) const { return Ptr<K>(); }
  24. void DisposeObjekt (void) {}
  25. };
  26. class Objct
  27. {
  28. public:
  29. Objct () {}
  30. virtual ~Objct () {}
  31. template <typename T> Ptr<T> QueryInterface (InterfaceId iid) const { return Ptr<T>(); }
  32. void DisposeObjct (void) {}
  33. };
  34. #ifdef SWIG
  35. %template(PtrObjct) Ptr<Objct>;
  36. %template(PtrInt) Ptr<int>;
  37. %template(ObjektInt) Objekt<int>;
  38. %template(PtrObjektInt) Ptr<Objekt<int> >;
  39. %template(QueryInterfaceObjct) Objct::QueryInterface<Objct>;
  40. #endif
  41. }; // namespace
  42. %}