Enum typemaps taken out of csharp.swg.

New typemap files for the different C/C++ to C# enum wrapping approaches.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5920 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2004-05-24 20:08:04 +00:00
commit 5767cdfa94
4 changed files with 141 additions and 23 deletions

32
SWIG/Lib/csharp/enums.swg Normal file
View file

@ -0,0 +1,32 @@
/* -----------------------------------------------------------------------------
* Include this file in order for C/C++ enums to be wrapped by proper C# enums.
* Note that the PINVOKE layer handles the enum as an int.
* ----------------------------------------------------------------------------- */
%typemap(ctype) enum SWIGTYPE "int"
%typemap(imtype) enum SWIGTYPE "int"
%typemap(cstype) enum SWIGTYPE "$csclassname"
%typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %}
%typemap(out) enum SWIGTYPE %{ $result = $1; %}
%typecheck(SWIG_TYPECHECK_INT32) enum SWIGTYPE ""
%typemap(throws) enum SWIGTYPE {
SWIG_CSharpThrowException(SWIG_CSharpException, "C++ $1_type exception thrown");
}
%typemap(csin) enum SWIGTYPE "(int)$csinput"
%typemap(csout) enum SWIGTYPE {
return ($csclassname)$imcall;
}
%typemap(csvarout) enum SWIGTYPE %{
get {
return ($csclassname)$imcall;
} %}
%typemap(csclassmodifiers) enum SWIGTYPE "public enum"
%csenum(proper);