1 #include "reflection.h"
2 #include <msp/debug/demangle.h>
9 ClassBase::ClassBase(Reflector &r, type_index t):
12 name(Debug::demangle(t.name()))
15 bool ClassBase::is_direct_base_of(const ClassBase &other) const
17 return ranges::find(other.bases, this)!=other.bases.end();
20 bool ClassBase::is_base_of(const ClassBase &other) const
22 if(is_direct_base_of(other))
24 return ranges::any_of(other.bases, [this](const ClassBase *b){ return is_base_of(*b); });
28 ClassBase *Reflector::find_class(const type_index &type) const
30 auto i = lower_bound(type);
31 return (i!=classes.end() && (*i)->get_type()==type ? i->get() : nullptr);
34 } // namespace Reflection
35 } // namespace Msp::Game