.doc/ext/rucy/class.cpp in rucy-0.1.7 vs .doc/ext/rucy/class.cpp in rucy-0.1.8

- old
+ new

@@ -7,21 +7,27 @@ using namespace Rucy; static Class cBase, cSub, cSimpleObj; -RUCY_WRAPPER_VALUE_FROM_TO(Base, cBase) -RUCY_WRAPPER_VALUE_FROM_TO(Sub, cSub) -RUCY_WRAPPER_VALUE_FROM_TO(SimpleObj, cSimpleObj) +namespace Rucy +{ -template <typename T> Class get_class (); + template <> inline Class get_ruby_class<Base> () {return cBase;} -template <> Class get_class<Base> () {return cBase;} + template <> inline Class get_ruby_class<Sub> () {return cSub;} -template <> Class get_class<Sub> () {return cSub;} + template <> inline Class get_ruby_class<SimpleObj> () {return cSimpleObj;} +}// Rucy + +RUCY_WRAPPER_VALUE_FROM_TO(Base) +RUCY_WRAPPER_VALUE_FROM_TO(Sub) +RUCY_WRAPPER_VALUE_FROM_TO(SimpleObj) + + template <typename T> class RubyBase : public ClassWrapper<T> { public: @@ -39,28 +45,28 @@ } virtual const char* name_overridable_faster () const { RUCY_SYM(name_overridable_faster); - if (RUCY_IS_OVERRIDDEN(name_overridable_faster, get_class<T>())) + if (RUCY_IS_OVERRIDDEN(name_overridable_faster)) return this->value.call(name_overridable_faster).c_str(); else return Super::name_overridable_faster(); } bool is_name_overridable_faster_overridden () const { RUCY_SYM(name_overridable_faster); - return RUCY_IS_OVERRIDDEN(name_overridable_faster, get_class<T>()); + return RUCY_IS_OVERRIDDEN(name_overridable_faster); } };// RubyBase #define THIS(type) to<type*>(self) -#define CHECK(type) RUCY_CHECK_OBJ(type, c##type, self) +#define CHECK(type) RUCY_CHECK_OBJ(type, self) #define CALL(type, obj, fun) RUCY_WRAPPER_CALL(type, obj, fun) /* @@ -116,17 +122,17 @@ template <typename T> static VALUE is_name_overridable_faster_overridden(VALUE self) { - RUCY_CHECK_OBJ(T, get_class<T>(), self); + RUCY_CHECK_OBJ(T, self); RubyBase<T>* obj = dynamic_cast<RubyBase<T>*>(THIS(T)); if (!obj) invalid_object_error(__FILE__, __LINE__, "dynamic_cast() failed."); return value(obj->is_name_overridable_faster_overridden()); } -static RUCY_DEF_clear_override_flags(Base_clear_override_flags, Base, cBase); -static RUCY_DEF_clear_override_flags(Sub_clear_override_flags, Sub, cSub); +static RUCY_DEF_clear_override_flags(Base_clear_override_flags, Base); +static RUCY_DEF_clear_override_flags(Sub_clear_override_flags, Sub); static VALUE base_new_raw(VALUE self) { return value(new Base);