PageRenderTime 35ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-25/SWIG/Examples/test-suite/csharp_attributes.i

#
Swig | 48 lines | 40 code | 8 blank | 0 comment | 0 complexity | 6381e92217b8b66ea6ea17c7d8eed65e MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module csharp_attributes
  2. // Test the inattributes and outattributes typemaps
  3. %typemap(cstype, outattributes="[IntOut]", inattributes="[IntIn]") int "int"
  4. %typemap(imtype, outattributes="[IntegerOut]", inattributes="[IntegerIn]") int "int"
  5. %inline %{
  6. class Stations {
  7. public:
  8. Stations(int myInt) { }
  9. int Reading(int myInt) { return myInt; }
  10. static int Swindon(int myInt) { return myInt; }
  11. };
  12. #define TESTMACRO 10
  13. int GlobalFunction(int myInt) { return myInt; }
  14. %}
  15. // Test the attributes feature
  16. %csattributes MoreStations::MoreStations() "[InterCity1]"
  17. %csattributes MoreStations::Chippenham() "[InterCity2]"
  18. %csattributes MoreStations::Bath() "[InterCity3]"
  19. %csattributes Bristol "[InterCity4]"
  20. %csattributes WestonSuperMare "[InterCity5]"
  21. %csattributes Wales "[InterCity6]"
  22. %csattributes Paddington() "[InterCity7]"
  23. %csattributes DidcotParkway "[InterCity8]"
  24. %typemap(csattributes) MoreStations "[Eurostar1]"
  25. %typemap(csattributes) MoreStations::Wales "[Eurostar2]"
  26. %typemap(csattributes) Cymru "[Eurostar3]"
  27. %inline %{
  28. struct MoreStations {
  29. MoreStations() : Bristol(0) {}
  30. void Chippenham() {}
  31. static void Bath() {}
  32. int Bristol;
  33. static double WestonSuperMare;
  34. enum Wales { Cardiff = 1, Swansea };
  35. };
  36. void Paddington() {}
  37. float DidcotParkway;
  38. enum Cymru { Llanelli };
  39. double MoreStations::WestonSuperMare = 0.0;
  40. %}