C# attribute support added - %csattributes feature, %csattributes typemap
and inattributes & outattributes typemap attributes for the imtype and cstype typemaps. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7184 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
05b188441c
commit
a0712b227f
7 changed files with 367 additions and 18 deletions
48
Examples/test-suite/csharp_attributes.i
Normal file
48
Examples/test-suite/csharp_attributes.i
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
%module csharp_attributes
|
||||
|
||||
// Test the inattributes and outattributes typemaps
|
||||
%typemap(cstype, outattributes="[IntOut]", inattributes="[IntIn]") int "int"
|
||||
%typemap(imtype, outattributes="[IntegerOut]", inattributes="[IntegerIn]") int "int"
|
||||
|
||||
%inline %{
|
||||
class Stations {
|
||||
public:
|
||||
Stations(int myInt) { }
|
||||
int Reading(int myInt) { return myInt; }
|
||||
static int Swindon(int myInt) { return myInt; }
|
||||
};
|
||||
#define TESTMACRO 10
|
||||
int GlobalFunction(int myInt) { return myInt; }
|
||||
%}
|
||||
|
||||
|
||||
// Test the attributes feature
|
||||
%csattributes MoreStations::MoreStations() "[InterCity1]"
|
||||
%csattributes MoreStations::Chippenham() "[InterCity2]"
|
||||
%csattributes MoreStations::Bath() "[InterCity3]"
|
||||
%csattributes Bristol "[InterCity4]"
|
||||
%csattributes WestonSuperMare "[InterCity5]"
|
||||
%csattributes Wales "[InterCity6]"
|
||||
%csattributes Paddington() "[InterCity7]"
|
||||
%csattributes DidcotParkway "[InterCity8]"
|
||||
|
||||
%typemap(csattributes) MoreStations "[Eurostar1]"
|
||||
%typemap(csattributes) MoreStations::Wales "[Eurostar2]"
|
||||
%typemap(csattributes) Cymru "[Eurostar3]"
|
||||
|
||||
%inline %{
|
||||
struct MoreStations {
|
||||
MoreStations() : Bristol(0) {}
|
||||
void Chippenham() {}
|
||||
static void Bath() {}
|
||||
int Bristol;
|
||||
static double WestonSuperMare;
|
||||
enum Wales { Cardiff = 1, Swansea };
|
||||
};
|
||||
void Paddington() {}
|
||||
float DidcotParkway;
|
||||
enum Cymru { Llanelli };
|
||||
|
||||
double MoreStations::WestonSuperMare = 0.0;
|
||||
%}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue