diff --git a/scripts/mkqtdecl4/mkqtdecl.conf b/scripts/mkqtdecl4/mkqtdecl.conf index 92973c77b..0eee55821 100644 --- a/scripts/mkqtdecl4/mkqtdecl.conf +++ b/scripts/mkqtdecl4/mkqtdecl.conf @@ -341,7 +341,7 @@ add_native_impl("QChildEvent", <<'CODE', <<'DECL') virtual bool can_upcast (const void *) const { return false; } // Does not bind to a particular type - virtual bool is_of_type (const std::type_info & /*ti*/) const { return false; } + virtual bool binds () const { return false; } virtual const std::type_info &type () const { return typeid (DummyQObject); } }; } diff --git a/src/gsi/gsi/gsiClass.h b/src/gsi/gsi/gsiClass.h index ad52d9faa..84eaf7edd 100644 --- a/src/gsi/gsi/gsiClass.h +++ b/src/gsi/gsi/gsiClass.h @@ -585,9 +585,9 @@ public: set_name (name); } - virtual bool is_of_type (const std::type_info &ti) const + virtual bool binds () const { - return (ti == typeid (X)); + return false; } virtual const std::type_info &type () const @@ -865,15 +865,9 @@ public: return m_subclass_tester.get () && m_subclass_tester->can_upcast (p); } - virtual bool is_of_type (const std::type_info &ti) const + virtual bool binds () const { - if (adapted_type_info ()) { - // A class matches the typeinfo of the adapted type. We'll sort this out later - // on the client side. - return (ti == *adapted_type_info ()); - } else { - return (ti == typeid (X)); - } + return true; } virtual const std::type_info &type () const diff --git a/src/gsi/gsi/gsiClassBase.cc b/src/gsi/gsi/gsiClassBase.cc index 7ee9acd8f..97e2d551c 100644 --- a/src/gsi/gsi/gsiClassBase.cc +++ b/src/gsi/gsi/gsiClassBase.cc @@ -816,7 +816,7 @@ bool has_class (const std::string &name) static void add_class_to_map (const gsi::ClassBase *c) { - if (c->declaration () != c) { + if (c->declaration () != c || ! c->binds ()) { // only consider non-extensions return; } @@ -833,14 +833,12 @@ static void add_class_to_map (const gsi::ClassBase *c) sp_tname_to_class = new tname_to_class_map_t (); } - if (ti && c->is_of_type (*ti)) { - if (!sp_ti_to_class->insert (std::make_pair (ti, c)).second) { - // Duplicate registration of this class - tl::error << "Duplicate registration of class " << c->name () << " (type " << ti->name () << ")"; - tl_assert (false); - } else { - sp_tname_to_class->insert (std::make_pair (std::string (ti->name ()), c)); - } + if (!sp_ti_to_class->insert (std::make_pair (ti, c)).second) { + // Duplicate registration of this class + tl::error << "Duplicate registration of class " << c->name () << " (type " << ti->name () << ")"; + tl_assert (false); + } else { + sp_tname_to_class->insert (std::make_pair (std::string (ti->name ()), c)); } } diff --git a/src/gsi/gsi/gsiClassBase.h b/src/gsi/gsi/gsiClassBase.h index dcea483fe..92728ed91 100644 --- a/src/gsi/gsi/gsiClassBase.h +++ b/src/gsi/gsi/gsiClassBase.h @@ -446,12 +446,9 @@ public: } /** - * @brief Class implementation: check C++ type of object - * - * This method returns true, if objects of this class are compatible with - * the given C++ type. + * @brief Class implementation: returns true if this class binds to a script class */ - virtual bool is_of_type (const std::type_info & /*ti*/) const + virtual bool binds () const { tl_assert (false); return false; diff --git a/src/gsiqt/qt4/QtCore/gsiDeclQChildEvent.cc b/src/gsiqt/qt4/QtCore/gsiDeclQChildEvent.cc index 5fba58c6d..dc356c1bd 100644 --- a/src/gsiqt/qt4/QtCore/gsiDeclQChildEvent.cc +++ b/src/gsiqt/qt4/QtCore/gsiDeclQChildEvent.cc @@ -60,7 +60,7 @@ virtual bool can_upcast (const void *) const { return false; } // Does not bind to a particular type - virtual bool is_of_type (const std::type_info & /*ti*/) const { return false; } + virtual bool binds () const { return false; } virtual const std::type_info &type () const { return typeid (DummyQObject); } }; }