mirror of https://github.com/swig/swig
Update for new enum wrapping which uses proper C# enums
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5952 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
8e3942823f
commit
e18288ecab
|
@ -5,7 +5,7 @@ enum color { RED, BLUE, GREEN };
|
|||
class Foo {
|
||||
public:
|
||||
Foo() { }
|
||||
enum speed { IMPULSE, WARP, LUDICROUS };
|
||||
enum speed { IMPULSE=10, WARP=20, LUDICROUS=30 };
|
||||
void enum_test(speed s);
|
||||
};
|
||||
|
||||
|
|
|
@ -6,27 +6,26 @@ public class runme
|
|||
{
|
||||
// Print out the value of some enums
|
||||
Console.WriteLine("*** color ***");
|
||||
Console.WriteLine(" RED = " + example.RED);
|
||||
Console.WriteLine(" BLUE = " + example.BLUE);
|
||||
Console.WriteLine(" GREEN = " + example.GREEN);
|
||||
Console.WriteLine(" " + color.RED + " = " + (int)color.RED);
|
||||
Console.WriteLine(" " + color.BLUE + " = " + (int)color.BLUE);
|
||||
Console.WriteLine(" " + color.GREEN + " = " + (int)color.GREEN);
|
||||
|
||||
Console.WriteLine("\n*** Foo::speed ***");
|
||||
Console.WriteLine(" Foo::IMPULSE = " + Foo.IMPULSE);
|
||||
Console.WriteLine(" Foo::WARP = " + Foo.WARP);
|
||||
Console.WriteLine(" Foo::LUDICROUS = " + Foo.LUDICROUS);
|
||||
Console.WriteLine(" Foo::" + Foo.speed.IMPULSE + " = " + (int)Foo.speed.IMPULSE);
|
||||
Console.WriteLine(" Foo::" + Foo.speed.WARP + " = " + (int)Foo.speed.WARP);
|
||||
Console.WriteLine(" Foo::" + Foo.speed.LUDICROUS + " = " + (int)Foo.speed.LUDICROUS);
|
||||
|
||||
Console.WriteLine("\nTesting use of enums with functions\n");
|
||||
|
||||
example.enum_test(example.RED, Foo.IMPULSE);
|
||||
example.enum_test(example.BLUE, Foo.WARP);
|
||||
example.enum_test(example.GREEN, Foo.LUDICROUS);
|
||||
example.enum_test(1234,5678);
|
||||
example.enum_test(color.RED, Foo.speed.IMPULSE);
|
||||
example.enum_test(color.BLUE, Foo.speed.WARP);
|
||||
example.enum_test(color.GREEN, Foo.speed.LUDICROUS);
|
||||
|
||||
Console.WriteLine( "\nTesting use of enum with class method" );
|
||||
Foo f = new Foo();
|
||||
|
||||
f.enum_test(Foo.IMPULSE);
|
||||
f.enum_test(Foo.WARP);
|
||||
f.enum_test(Foo.LUDICROUS);
|
||||
f.enum_test(Foo.speed.IMPULSE);
|
||||
f.enum_test(Foo.speed.WARP);
|
||||
f.enum_test(Foo.speed.LUDICROUS);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue