00001 #ifndef Exc_Ruby__Enum_Wrapper__hpp_
00002 #define Exc_Ruby__Enum_Wrapper__hpp_
00003
00004 #ident "$Id$"
00005
00006 #include "excruby/exceptional_ruby.hpp"
00007
00008 namespace Exc_Ruby
00009 {
00010
00011 template<typename Enum_T>
00012 class Enum_Wrapper
00013 {
00014 public:
00015 Enum_Wrapper();
00016 virtual ~Enum_Wrapper();
00017
00018
00019 virtual Enum_Wrapper<Enum_T> & initialize(
00020 VALUE module,
00021 char const * name);
00022
00023
00024 virtual Enum_Wrapper<Enum_T> & define_value(
00025 char const * name,
00026 Enum_T value);
00027
00028
00029 Ruby_Type<Enum_T> const & type();
00030
00031 private:
00032 static VALUE each(VALUE self);
00033 static VALUE to_s(VALUE self);
00034 static VALUE to_i(VALUE self);
00035 static VALUE inspect(VALUE self);
00036 static VALUE compare(VALUE lhs, VALUE rhs);
00037 static VALUE eql(VALUE lhs, VALUE rhs);
00038 static VALUE hash(VALUE self);
00039 static VALUE from_int(VALUE klass, VALUE i);
00040 private:
00041 Ruby_Type<Enum_T> ruby_type_;
00042 VALUE enums_;
00043 VALUE names_;
00044 };
00045
00046 }
00047
00048 #include "enum_wrapper.ipp"
00049
00050 #endif // Exc_Ruby__Enum_Wrapper__hpp_
00051