PageRenderTime 43ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Swig | 62 lines | 53 code | 9 blank | 0 comment | 0 complexity | cd94b06e4bf7cba8923b8765328392be MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module(directors="1") 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. //%include "enumsimple.swg"
  16. //%include "enumtypesafe.swg"
  17. // Test the attributes feature
  18. %csattributes MoreStations::MoreStations() "[InterCity1]"
  19. %csattributes MoreStations::Chippenham() "[InterCity2]"
  20. %csattributes MoreStations::Bath() "[InterCity3]"
  21. %csattributes Bristol "[InterCity4]"
  22. %csattributes WestonSuperMare "[InterCity5]"
  23. %csattributes Wales "[InterCity6]"
  24. %csattributes Paddington() "[InterCity7]"
  25. %csattributes DidcotParkway "[InterCity8]"
  26. %csattributes MoreStations::Cardiff "[System.ComponentModel.Description(\"Cardiff city station\")]"
  27. %csattributes Swansea "[System.ComponentModel.Description(\"Swansea city station\")]"
  28. %typemap(csattributes) MoreStations "[Eurostar1]"
  29. %typemap(csattributes) MoreStations::Wales "[Eurostar2]"
  30. %typemap(csattributes) Cymru "[Eurostar3]"
  31. %inline %{
  32. struct MoreStations {
  33. MoreStations() : Bristol(0) {}
  34. void Chippenham() {}
  35. static void Bath() {}
  36. int Bristol;
  37. static double WestonSuperMare;
  38. enum Wales { Cardiff = 1, Swansea };
  39. };
  40. void Paddington() {}
  41. float DidcotParkway;
  42. enum Cymru { Llanelli };
  43. double MoreStations::WestonSuperMare = 0.0;
  44. %}
  45. // Test directorinattributes and directoroutattributes
  46. %typemap(imtype, directoroutattributes="[DirectorIntegerOut]", directorinattributes="[DirectorIntegerIn]") int "int"
  47. %feature("director") YetMoreStations;
  48. %inline %{
  49. struct YetMoreStations {
  50. virtual int Slough(int x) { return x; }
  51. virtual ~YetMoreStations() {}
  52. };
  53. %}