|
Rice
3.0.0
|
A wrapper for enumerated types. More...
#include <Enum.hpp>
Public Member Functions | |
| Enum () | |
| Default constructor. | |
| Enum (char const *name, Module module=rb_cObject) | |
| Construct and initialize. | |
| Enum (Enum const &other) | |
| Copy constructor. | |
| Enum & | operator= (Enum const &other) |
| Assignment operator. | |
| virtual | ~Enum () |
| Destructor. | |
| Enum< Enum_T, Enum_Traits > & | define_value (char const *name, Enum_T value) |
| Define a new enum value. More... | |
| void | swap (Enum &other) |
Public Member Functions inherited from Rice::Module_impl< Data_Type< Enum_T >, Enum< Enum_T, Default_Enum_Traits< Enum_T > > > | |
| Module_impl (T const &arg) | |
| Enum< Enum_T, Default_Enum_Traits< Enum_T > > & | add_handler (Functor_T functor) |
| Define an exception handler. More... | |
| Enum< Enum_T, Default_Enum_Traits< Enum_T > > & | define_method (Identifier name, Func_T func, Arguments *arguments=0) |
| Define an instance method. More... | |
| Enum< Enum_T, Default_Enum_Traits< Enum_T > > & | define_method (Identifier name, Func_T func, Arg const &arg) |
| Enum< Enum_T, Default_Enum_Traits< Enum_T > > & | define_singleton_method (Identifier name, Func_T func, Arguments *arguments=0) |
| Define a singleton method. More... | |
| Enum< Enum_T, Default_Enum_Traits< Enum_T > > & | define_singleton_method (Identifier name, Func_T func, Arg const &arg) |
| Enum< Enum_T, Default_Enum_Traits< Enum_T > > & | define_module_function (Identifier name, Func_T func, Arguments *arguments=0) |
| Define a module function. More... | |
| Enum< Enum_T, Default_Enum_Traits< Enum_T > > & | define_module_function (Identifier name, Func_T func, Arg const &arg) |
| Enum< Enum_T, Default_Enum_Traits< Enum_T > > & | define_iterator (Iterator_T(T::*begin)(), Iterator_T(T::*end)(), Identifier name="each") |
| Define an iterator. More... | |
| Enum< Enum_T, Default_Enum_Traits< Enum_T > > & | include_module (Module const &inc) |
| Include a module. More... | |
| Enum< Enum_T, Default_Enum_Traits< Enum_T > > & | const_set (Identifier name, Object value) |
| Set a constant. More... | |
| Object | const_get (Identifier name) const |
| Get a constant. More... | |
| bool | const_defined (Identifier name) const |
| Determine whether a constant is defined. More... | |
| void | remove_const (Identifier name) |
| Remove a constant. More... | |
| Module | define_module (char const *name) |
| Define a module under this module. More... | |
| Class | define_class (char const *name, Object superclass=rb_cObject) |
| Define a class under this module. More... | |
| Data_Type< T > | define_class (char const *name) |
| Define a new data class under this module. More... | |
| Data_Type< T > | define_class (char const *name) |
| Define a new data class under this module. More... | |
Public Member Functions inherited from Rice::Data_Type< Enum_T > | |
| Data_Type () | |
| Default constructor which does not bind. More... | |
| Data_Type (Module const &v) | |
| Constructor which takes a Module. More... | |
| virtual | ~Data_Type () |
| Destructor. | |
| virtual Data_Type & | operator= (Module const &klass) |
| Assignment operator which takes a Module. More... | |
| Data_Type< Enum_T > & | define_constructor (Constructor_T constructor, Arguments *arguments=0) |
| Define a constructor for the class. More... | |
| Data_Type< Enum_T > & | define_constructor (Constructor_T constructor, Arg const &arg) |
| Data_Type< Enum_T > & | define_director () |
| Register a Director class for this class. More... | |
| virtual detail::Abstract_Caster * | caster () const |
Public Member Functions inherited from Rice::Module_impl< Data_Type_Base, Data_Type< Enum_T > > | |
| Module_impl (T const &arg) | |
| Data_Type< Enum_T > & | add_handler (Functor_T functor) |
| Define an exception handler. More... | |
| Data_Type< Enum_T > & | define_method (Identifier name, Func_T func, Arguments *arguments=0) |
| Define an instance method. More... | |
| Data_Type< Enum_T > & | define_method (Identifier name, Func_T func, Arg const &arg) |
| Data_Type< Enum_T > & | define_singleton_method (Identifier name, Func_T func, Arguments *arguments=0) |
| Define a singleton method. More... | |
| Data_Type< Enum_T > & | define_singleton_method (Identifier name, Func_T func, Arg const &arg) |
| Data_Type< Enum_T > & | define_module_function (Identifier name, Func_T func, Arguments *arguments=0) |
| Define a module function. More... | |
| Data_Type< Enum_T > & | define_module_function (Identifier name, Func_T func, Arg const &arg) |
| Data_Type< Enum_T > & | define_iterator (Iterator_T(T::*begin)(), Iterator_T(T::*end)(), Identifier name="each") |
| Define an iterator. More... | |
| Data_Type< Enum_T > & | include_module (Module const &inc) |
| Include a module. More... | |
| Data_Type< Enum_T > & | const_set (Identifier name, Object value) |
| Set a constant. More... | |
| Object | const_get (Identifier name) const |
| Get a constant. More... | |
| bool | const_defined (Identifier name) const |
| Determine whether a constant is defined. More... | |
| void | remove_const (Identifier name) |
| Remove a constant. More... | |
| Module | define_module (char const *name) |
| Define a module under this module. More... | |
| Class | define_class (char const *name, Object superclass=rb_cObject) |
| Define a class under this module. More... | |
| Data_Type< T > | define_class (char const *name) |
| Define a new data class under this module. More... | |
| Data_Type< T > | define_class (char const *name) |
| Define a new data class under this module. More... | |
Public Member Functions inherited from Rice::Data_Type_Base | |
| Data_Type_Base () | |
| Default constructor. | |
| Data_Type_Base (VALUE v) | |
| Constructor. | |
| virtual | ~Data_Type_Base ()=0 |
| Destructor. | |
Public Member Functions inherited from Rice::Module_impl< Class, Data_Type_Base > | |
| Module_impl (T const &arg) | |
| Data_Type_Base & | add_handler (Functor_T functor) |
| Define an exception handler. More... | |
| Data_Type_Base & | define_method (Identifier name, Func_T func, Arguments *arguments=0) |
| Define an instance method. More... | |
| Data_Type_Base & | define_method (Identifier name, Func_T func, Arg const &arg) |
| Data_Type_Base & | define_singleton_method (Identifier name, Func_T func, Arguments *arguments=0) |
| Define a singleton method. More... | |
| Data_Type_Base & | define_singleton_method (Identifier name, Func_T func, Arg const &arg) |
| Data_Type_Base & | define_module_function (Identifier name, Func_T func, Arguments *arguments=0) |
| Define a module function. More... | |
| Data_Type_Base & | define_module_function (Identifier name, Func_T func, Arg const &arg) |
| Data_Type_Base & | define_iterator (Iterator_T(T::*begin)(), Iterator_T(T::*end)(), Identifier name="each") |
| Define an iterator. More... | |
| Data_Type_Base & | include_module (Module const &inc) |
| Include a module. More... | |
| Data_Type_Base & | const_set (Identifier name, Object value) |
| Set a constant. More... | |
| Object | const_get (Identifier name) const |
| Get a constant. More... | |
| bool | const_defined (Identifier name) const |
| Determine whether a constant is defined. More... | |
| void | remove_const (Identifier name) |
| Remove a constant. More... | |
| Module | define_module (char const *name) |
| Define a module under this module. More... | |
| Class | define_class (char const *name, Object superclass=rb_cObject) |
| Define a class under this module. More... | |
| Data_Type< T > | define_class (char const *name) |
| Define a new data class under this module. More... | |
| Data_Type< T > | define_class (char const *name) |
| Define a new data class under this module. More... | |
Public Member Functions inherited from Rice::Class | |
| Class () | |
| Class (VALUE v) | |
| Construct a new class wrapper from a ruby object of type T_CLASS. | |
| Class & | undef_creation_funcs () |
| Disallow creation of an instance from Ruby code. More... | |
Public Member Functions inherited from Rice::Module_impl< Module, Class > | |
| Module_impl (T const &arg) | |
| Class & | add_handler (Functor_T functor) |
| Define an exception handler. More... | |
| Class & | define_method (Identifier name, Func_T func, Arguments *arguments=0) |
| Define an instance method. More... | |
| Class & | define_method (Identifier name, Func_T func, Arg const &arg) |
| Class & | define_singleton_method (Identifier name, Func_T func, Arguments *arguments=0) |
| Define a singleton method. More... | |
| Class & | define_singleton_method (Identifier name, Func_T func, Arg const &arg) |
| Class & | define_module_function (Identifier name, Func_T func, Arguments *arguments=0) |
| Define a module function. More... | |
| Class & | define_module_function (Identifier name, Func_T func, Arg const &arg) |
| Class & | define_iterator (Iterator_T(T::*begin)(), Iterator_T(T::*end)(), Identifier name="each") |
| Define an iterator. More... | |
| Class & | include_module (Module const &inc) |
| Include a module. More... | |
| Class & | const_set (Identifier name, Object value) |
| Set a constant. More... | |
| Object | const_get (Identifier name) const |
| Get a constant. More... | |
| bool | const_defined (Identifier name) const |
| Determine whether a constant is defined. More... | |
| void | remove_const (Identifier name) |
| Remove a constant. More... | |
| Module | define_module (char const *name) |
| Define a module under this module. More... | |
| Class | define_class (char const *name, Object superclass=rb_cObject) |
| Define a class under this module. More... | |
| Data_Type< T > | define_class (char const *name) |
| Define a new data class under this module. More... | |
| Data_Type< T > | define_class (char const *name) |
| Define a new data class under this module. More... | |
Public Member Functions inherited from Rice::Module | |
| Module () | |
| Default construct a Module and initialize it to rb_cObject. | |
| Module (VALUE v) | |
| Construct a Module from an existing Module object. | |
| String | name () const |
| Return the name of the module. | |
| void | swap (Module &other) |
| Swap with another Module. | |
| Array | ancestors () const |
| Return an array containing the Module's ancestors. More... | |
| Class | singleton_class () const |
| Return the module's singleton class. More... | |
Public Member Functions inherited from Rice::Module_impl< Module_base, Module > | |
| Module_impl (T const &arg) | |
| Module & | add_handler (Functor_T functor) |
| Define an exception handler. More... | |
| Module & | define_method (Identifier name, Func_T func, Arguments *arguments=0) |
| Define an instance method. More... | |
| Module & | define_method (Identifier name, Func_T func, Arg const &arg) |
| Module & | define_singleton_method (Identifier name, Func_T func, Arguments *arguments=0) |
| Define a singleton method. More... | |
| Module & | define_singleton_method (Identifier name, Func_T func, Arg const &arg) |
| Module & | define_module_function (Identifier name, Func_T func, Arguments *arguments=0) |
| Define a module function. More... | |
| Module & | define_module_function (Identifier name, Func_T func, Arg const &arg) |
| Module & | define_iterator (Iterator_T(T::*begin)(), Iterator_T(T::*end)(), Identifier name="each") |
| Define an iterator. More... | |
| Module & | include_module (Module const &inc) |
| Include a module. More... | |
| Module & | const_set (Identifier name, Object value) |
| Set a constant. More... | |
| Object | const_get (Identifier name) const |
| Get a constant. More... | |
| bool | const_defined (Identifier name) const |
| Determine whether a constant is defined. More... | |
| void | remove_const (Identifier name) |
| Remove a constant. More... | |
| Module | define_module (char const *name) |
| Define a module under this module. More... | |
| Class | define_class (char const *name, Object superclass=rb_cObject) |
| Define a class under this module. More... | |
| Data_Type< T > | define_class (char const *name) |
| Define a new data class under this module. More... | |
| Data_Type< T > | define_class (char const *name) |
| Define a new data class under this module. More... | |
Public Member Functions inherited from Rice::Module_base | |
| Module_base (VALUE v=rb_cObject) | |
| Module_base (Module_base const &other) | |
| Module_base & | operator= (Module_base const &other) |
| void | swap (Module_base &other) |
Public Member Functions inherited from Rice::Object | |
| Object (VALUE value=Qnil) | |
| Encapsulate an existing ruby object. | |
| Object (Object const &other) | |
| Copy constructor. | |
| virtual | ~Object () |
| Destructor. | |
| bool | test () const |
| operator bool () const | |
| bool | is_nil () const |
| Returns true if the object is nil, false otherwise. | |
| operator VALUE () const | |
| Implicit conversion to VALUE. | |
| VALUE const volatile & | value () const |
| Explicitly get the encapsulated VALUE. | |
| Class | class_of () const |
| Get the class of an object. More... | |
| int | compare (Object const &other) const |
| Compare this object to another object. More... | |
| String | to_s () const |
| Return a string representation of an object. More... | |
| String | inspect () const |
| Inspect the object. More... | |
| void | freeze () |
| Freeze the object. | |
| bool | is_frozen () const |
| Determine if the object is frozen. More... | |
| void | swap (Object &other) |
| Swap with another Object. | |
| Object | instance_eval (String const &s) |
| Evaluate the given string in the context of the object. More... | |
| int | rb_type () const |
| Return the type of the underlying C object. More... | |
| bool | is_a (Object klass) const |
| Determine whether the object is an instance of a class/module. More... | |
| bool | respond_to (Identifier id) const |
| Determine if the objects responds to a method. More... | |
| bool | is_instance_of (Object klass) const |
| Determine whether class is the object's class. More... | |
| template<typename T > | |
| void | iv_set (Identifier name, T const &value) |
| Set an instance variable. More... | |
| Object | iv_get (Identifier name) const |
| Get the value of an instance variable. More... | |
| Object | attr_get (Identifier name) const |
| Get the value of an instance variable, but don't warn if it is. More... | |
| template<typename ... ArgT> | |
| Object | call (Identifier id, ArgT... args) const |
| Call the Ruby method specified by 'id' on object 'obj'. More... | |
| Object | vcall (Identifier id, Array args) |
| Vectorized call. More... | |
| void | mark () const |
| Mark the object with the garbage collector. | |
Additional Inherited Members | |
Public Types inherited from Rice::Data_Type< Enum_T > | |
| typedef Enum_T | Type |
| The C++ type being held. | |
Public Types inherited from Rice::Data_Type_Base | |
| typedef std::map< VALUE, detail::Abstract_Caster * > | Casters |
Static Public Member Functions inherited from Rice::Data_Type< Enum_T > | |
| static Module | klass () |
| Explictly return the Ruby type. More... | |
| static Enum_T * | from_ruby (Object x) |
| Convert ruby object x to type T. More... | |
| static bool | is_bound () |
| Determine if the type is bound. More... | |
Static Public Member Functions inherited from Rice::Data_Type_Base | |
| static Casters & | casters () |
Static Public Attributes inherited from Rice::Data_Type< Enum_T > | |
| static std_unique_ptr< detail::Abstract_Caster > | caster_ |
Protected Member Functions inherited from Rice::Module_base | |
| template<typename Exception_T , typename Functor_T > | |
| void | add_handler (Functor_T functor) |
| Object | handler () const |
Protected Member Functions inherited from Rice::Object | |
| void | set_value (VALUE v) |
| Set the encapsulated value. | |
| template<typename ... ArgT> | |
| std::vector< VALUE > | convert_args (ArgT &... args) const |
| Unpack the provided arguments and convert them all to Ruby types. | |
Static Protected Member Functions inherited from Rice::Data_Type< Enum_T > | |
| static Data_Type | bind (Module const &klass) |
| Bind a Data_Type to a VALUE. More... | |
A wrapper for enumerated types.
Provides a simple type-safe wrapper for enumerated types. At the ruby level, the class will have convenience methods for iterating over all the defined enum values, converting the values to strings, and more.
| Enum_T | the enumerated type |
| Enum_Traits | specifies the traits of the enumerated type. |
Example:
| Enum<Enum_T, Enum_Traits>& Rice::Enum< Enum_T, Enum_Traits >::define_value | ( | char const * | name, |
| Enum_T | value | ||
| ) |
Define a new enum value.
| name | the name of the enum value. |
| value | the value to associate with name. |