PageRenderTime 50ms CodeModel.GetById 6ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Swig | 41 lines | 33 code | 8 blank | 0 comment | 0 complexity | 434401e308efec5e7dae1a2064d74013 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module template_opaque
  2. %include "std_vector.i"
  3. %{
  4. namespace A
  5. {
  6. struct OpaqueStruct
  7. {
  8. };
  9. }
  10. enum Hello { hi, hello };
  11. %}
  12. %inline {
  13. namespace A {
  14. struct OpaqueStruct;
  15. typedef struct OpaqueStruct OpaqueType;
  16. typedef enum Hello Hi;
  17. typedef std::vector<OpaqueType> OpaqueVectorType;
  18. typedef std::vector<Hi> OpaqueVectorEnum;
  19. void FillVector(OpaqueVectorType& v)
  20. {
  21. for (size_t i = 0; i < v.size(); ++i) {
  22. v[i] = OpaqueStruct();
  23. }
  24. }
  25. void FillVector(const OpaqueVectorEnum& v)
  26. {
  27. }
  28. }
  29. }
  30. #ifndef SWIGCSHARP
  31. // C# vector typemaps only ready for simple cases right now
  32. %template(OpaqueVectorType) std::vector<A::OpaqueType>;
  33. #endif