import source from 1.3.40
[external/swig.git] / Examples / test-suite / csharp_attributes.i
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 %{
8 class Stations {
9 public:
10   Stations(int myInt) { }
11   int Reading(int myInt) { return myInt; }
12   static int Swindon(int myInt) { return myInt; }
13 };
14 #define TESTMACRO 10
15 int 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 %{
34 struct 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 };
42 void Paddington() {}
43 float DidcotParkway;
44 enum Cymru { Llanelli };
45
46 double MoreStations::WestonSuperMare = 0.0;
47 %}
48