various tweaks

ToString() method support


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5956 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2004-05-31 07:22:19 +00:00
commit ac855f9298

View file

@ -13,9 +13,9 @@
%typecheck(SWIG_TYPECHECK_INT32) enum SWIGTYPE "" %typecheck(SWIG_TYPECHECK_INT32) enum SWIGTYPE ""
%typemap(throws) enum SWIGTYPE { %typemap(throws) enum SWIGTYPE %{
SWIG_CSharpThrowException(SWIG_CSharpException, "C++ $1_type exception thrown"); SWIG_CSharpThrowException(SWIG_CSharpException, "C++ $1_type exception thrown");
} %}
%typemap(csin) enum SWIGTYPE "$csinput.swigValue" %typemap(csin) enum SWIGTYPE "$csinput.swigValue"
%typemap(csout) enum SWIGTYPE { %typemap(csout) enum SWIGTYPE {
@ -27,7 +27,7 @@
return $csclassname.swigToEnum($imcall); return $csclassname.swigToEnum($imcall);
} %} } %}
%typemap(csclassmodifiers) enum SWIGTYPE "public class" %typemap(csclassmodifiers) enum SWIGTYPE "public sealed class"
/* /*
* The swigToEnum method is used to find the C# enum from a C++ enum integer value. The default one here takes * The swigToEnum method is used to find the C# enum from a C++ enum integer value. The default one here takes
@ -48,17 +48,24 @@
throw new System.ArgumentOutOfRangeException("No enum $csclassname with value " + swigValue); throw new System.ArgumentOutOfRangeException("No enum $csclassname with value " + swigValue);
} }
private $csclassname() { public override string ToString() {
this.swigValue = next++; return swigName;
} }
private $csclassname(int swigValue) { private $csclassname(string swigName) {
this.swigName = swigName;
this.swigValue = swigNext++;
}
private $csclassname(string swigName, int swigValue) {
this.swigName = swigName;
this.swigValue = swigValue; this.swigValue = swigValue;
next = swigValue+1; swigNext = swigValue+1;
} }
private static $csclassname[] swigValues = { $enumvalues }; private static $csclassname[] swigValues = { $enumvalues };
private static int next = 0; private static int swigNext = 0;
private readonly string swigName;
%} %}
%csenum(typesafe); %csenum(typesafe);