#ifndef Rice__detail__from_ruby__ipp_ #define Rice__detail__from_ruby__ipp_ #include "../Data_Type.hpp" #include "../String.hpp" #include "demangle.hpp" #include template T Rice::detail::from_ruby_:: convert(Rice::Object x) { if(rb_type(x.value()) == T_DATA) { return *Data_Type::from_ruby(x); } else { std::string s("Unable to convert "); s += x.class_of().name().c_str(); s += " to "; s += demangle(typeid(T).name()); throw std::invalid_argument(s.c_str()); } } template T * Rice::detail::from_ruby_:: convert(Rice::Object x) { if(rb_type(x.value()) == T_DATA) { return Data_Type::from_ruby(x); } else { std::string s("Unable to convert "); s += x.class_of().name().c_str(); s += " to "; s += demangle(typeid(T *).name()); throw std::invalid_argument(s.c_str()); } } template T const * Rice::detail::from_ruby_:: convert(Rice::Object x) { return from_ruby(x); } template T & Rice::detail::from_ruby_:: convert(Rice::Object x) { return *from_ruby(x); } #endif // Rice__detail__from_ruby__ipp_