PageRenderTime 15ms CodeModel.GetById 14ms app.highlight 0ms RepoModel.GetById 1ms 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
 3// Test the inattributes and outattributes typemaps
 4%typemap(cstype, outattributes="[IntOut]", inattributes="[IntIn]") int "int"
 5%typemap(imtype, outattributes="[IntegerOut]", inattributes="[IntegerIn]") int "int"
 6
 7%inline %{
 8class Stations {
 9public:
10  Stations(int myInt) { }
11  int Reading(int myInt) { return myInt; }
12  static int Swindon(int myInt) { return myInt; }
13};
14#define TESTMACRO 10
15int GlobalFunction(int myInt) { return myInt; }
16%}
17
18
19// Test the attributes feature
20%csattributes MoreStations::MoreStations()      "[InterCity1]"
21%csattributes MoreStations::Chippenham()        "[InterCity2]"
22%csattributes MoreStations::Bath()              "[InterCity3]"
23%csattributes Bristol                           "[InterCity4]"
24%csattributes WestonSuperMare                   "[InterCity5]"
25%csattributes Wales                             "[InterCity6]"
26%csattributes Paddington()                      "[InterCity7]"
27%csattributes DidcotParkway                     "[InterCity8]"
28
29%typemap(csattributes) MoreStations "[Eurostar1]"
30%typemap(csattributes) MoreStations::Wales "[Eurostar2]"
31%typemap(csattributes) Cymru "[Eurostar3]"
32
33%inline %{
34struct MoreStations {
35  MoreStations() : Bristol(0) {}
36  void Chippenham() {}
37  static void Bath() {}
38  int Bristol;
39  static double WestonSuperMare;
40  enum Wales { Cardiff = 1, Swansea };
41};
42void Paddington() {}
43float DidcotParkway;
44enum Cymru { Llanelli };
45
46double MoreStations::WestonSuperMare = 0.0;
47%}
48