/tags/rel-1-3-26/SWIG/Examples/php4/enum/example.cxx
C++ | 37 lines | 33 code | 3 blank | 1 comment | 27 complexity | c4782af34e60c685f0c6f5d43cb5dcfd MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
1/* File : example.cxx */ 2 3#include "example.h" 4#include <stdio.h> 5 6void Foo::enum_test(speed s) { 7 if (s == IMPULSE) { 8 printf("IMPULSE speed\n"); 9 } else if (s == WARP) { 10 printf("WARP speed\n"); 11 } else if (s == LUDICROUS) { 12 printf("LUDICROUS speed\n"); 13 } else { 14 printf("Unknown speed\n"); 15 } 16} 17 18void enum_test(color c, Foo::speed s) { 19 if (c == RED) { 20 printf("color = RED, "); 21 } else if (c == BLUE) { 22 printf("color = BLUE, "); 23 } else if (c == GREEN) { 24 printf("color = GREEN, "); 25 } else { 26 printf("color = Unknown color!, "); 27 } 28 if (s == Foo::IMPULSE) { 29 printf("speed = IMPULSE speed\n"); 30 } else if (s == Foo::WARP) { 31 printf("speed = WARP speed\n"); 32 } else if (s == Foo::LUDICROUS) { 33 printf("speed = LUDICROUS speed\n"); 34 } else { 35 printf("speed = Unknown speed!\n"); 36 } 37}