PageRenderTime 44ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-29/SWIG/Examples/test-suite/constructor_copy.i

#
Swig | 154 lines | 105 code | 48 blank | 1 comment | 0 complexity | 39c6fd583f7502ad72a9056d5ecacfad MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module constructor_copy
  2. %copyctor;
  3. %nocopyctor Foo8;
  4. %nocopyctor Bar<double>;
  5. %inline %{
  6. struct Foo1 {
  7. int x;
  8. Foo1(int _x = 2) : x(_x)
  9. {
  10. }
  11. };
  12. struct Foo2 {
  13. Foo2() { }
  14. };
  15. struct Foo3 {
  16. Foo3() { }
  17. Foo3(const Foo3& ) { }
  18. };
  19. struct Foo4 {
  20. Foo4() { }
  21. protected:
  22. Foo4(const Foo4& ) { }
  23. };
  24. struct Foo4a {
  25. Foo4a() { }
  26. private:
  27. Foo4a(const Foo4a& ) { }
  28. };
  29. struct Foo5 : Foo4 {
  30. };
  31. struct Foo6 : Foo4 {
  32. Foo6(const Foo6& f) : Foo4(f) { }
  33. };
  34. struct Foo7 : Foo5 {
  35. };
  36. struct Foo8 {
  37. };
  38. template <class T>
  39. class Bar
  40. {
  41. public:
  42. int x;
  43. Bar(int _x = 0) : x(_x)
  44. {
  45. }
  46. };
  47. %}
  48. %template(Bari) Bar<int>;
  49. %template(Bard) Bar<double>;
  50. #if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGUTL)
  51. %include "std_vector.i"
  52. #if defined(SWIGCSHARP)
  53. SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(Flow, Space::Flow)
  54. #endif
  55. #if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON)
  56. #define SWIG_GOOD_VECTOR
  57. %ignore std::vector<Space::Flow>::vector(size_type);
  58. %ignore std::vector<Space::Flow>::resize(size_type);
  59. #endif
  60. #if defined(SWIGTCL) || defined(SWIGPERL) || defined(SWIGRUBY)
  61. #define SWIG_GOOD_VECTOR
  62. /* here, for languages with bad declaration */
  63. %ignore std::vector<Space::Flow>::vector(unsigned int);
  64. %ignore std::vector<Space::Flow>::resize(unsigned int);
  65. #endif
  66. %copyctor;
  67. %inline %{
  68. namespace Space {
  69. class Flow {
  70. public:
  71. Flow(int i) {}
  72. };
  73. }
  74. %}
  75. %template (VectFlow) std::vector<Space::Flow>;
  76. #endif
  77. %rename(ABC_Libor_ModelUtils) ABC_Nam::ABC_Libor::ModelUtils;
  78. %copyctor;
  79. %inline %{
  80. namespace ABC_Nam {
  81. namespace ABC_Libor {
  82. struct ModelUtils {};
  83. template <class T>
  84. struct ModelUtils_T {};
  85. }
  86. }
  87. %}
  88. %template(ModelUtils_i) ABC_Nam::ABC_Libor::ModelUtils_T<int>;
  89. %rename(Space1Space2_TotalReturnSwap) Space1::Space2::TotalReturnSwap;
  90. %copyctor;
  91. %inline %{
  92. namespace Space1 {
  93. namespace Space2 {
  94. class TotalReturnSwap {
  95. public:
  96. TotalReturnSwap() {}
  97. };
  98. template <class T>
  99. class TotalReturnSwap_T {
  100. public:
  101. TotalReturnSwap_T() {}
  102. };
  103. }
  104. }
  105. %}
  106. %template(Total_i) Space1::Space2::TotalReturnSwap_T<int>;