static std::string get_class_name(lua_State* L, LUABIND_TYPE_INFO i) { std::string ret; class_registry* r = class_registry::get_registry(L); class_rep* crep = r->find_class(i); if (crep == 0) { ret = "custom"; } else { if (LUABIND_TYPE_INFO_EQUAL(i, crep->holder_type())) { ret += "smart_ptr<"; ret += crep->name(); ret += ">"; } else if (LUABIND_TYPE_INFO_EQUAL(i, crep->const_holder_type())) { ret += "smart_ptr<const "; ret += crep->name(); ret += ">"; } else { ret += crep->name(); } } return ret; };
bool operator==(const overload_rep& o) { if (o.m_const != m_const) return false; if (o.m_arity != m_arity) return false; if (o.m_num_args != m_num_args) return false; for (int i = 0; i < m_num_args; ++i) if (!(LUABIND_TYPE_INFO_EQUAL(m_params[i], o.m_params[i]))) return false; return true; }
bool operator==(const overload_rep& o) { if (o.m_const != m_const) return false; if (o.m_arity != m_arity) return false; if (o.m_params_.size() != m_params_.size()) return false; for (int i = 0; i < (int)m_params_.size(); ++i) { if (!(LUABIND_TYPE_INFO_EQUAL(m_params_[i], o.m_params_[i]))) return false; } return true; }
int implicit_cast(const class_rep* crep, LUABIND_TYPE_INFO const& type_id, int& pointer_offset) { int offset = 0; if (LUABIND_TYPE_INFO_EQUAL(crep->type(), type_id)) return 0; for (std::vector<class_rep::base_info>::const_iterator i = crep->bases().begin(); i != crep->bases().end(); ++i) { int steps = implicit_cast(i->base, type_id, offset); pointer_offset = offset + i->pointer_offset; if (steps >= 0) return steps + 2; } return -1; }