]> git.tdb.fi Git - libs/game.git/blobdiff - source/game/reflection.cpp
Make it possible to find reflected classes by RTTI
[libs/game.git] / source / game / reflection.cpp
index d188e5081be09bccd32b605f7856f5dd84a31b67..43dd13a73e1c8ba01a64678aec85975213eb3eb8 100644 (file)
@@ -24,5 +24,12 @@ bool ClassBase::is_base_of(const ClassBase &other) const
        return ranges::any_of(other.bases, [this](const ClassBase *b){ return is_base_of(*b); });
 }
 
+
+ClassBase *Reflector::find_class(const type_index &type) const
+{
+       auto i = lower_bound(type);
+       return (i!=classes.end() && (*i)->get_type()==type ? i->get() : nullptr);
+}
+
 } // namespace Reflection
 } // namespace Msp::Game