Enums |
Exposing c++ enumerations can be done as shown below:
//Defining enumeration enum colors { red, green, blue }; enum global_values { fixed }; //exposing enumeration enum_<colors> cls("colors",c); cls.value("red",red); cls.value("green",green); cls.value("blue",blue); //Exposing enumeration to the global namespace cls.global_value("fixed",fixed);
In javascript, you can use this in the following way:
//Using the enumerated values; var red = colors.red; var green = colors.green; var blue =colors.blue; //The global vaules are, as stated, global: var fixed_value = fixed;
Copyright © 2003-2005 Peder Holt
Permission to copy, use, modify, sell and distribute this document
is granted provided this copyright notice appears in all copies. This document
is provided "as is" without express or implied warranty, and with
no claim as to its suitability for any purpose.