1#pragma once
2
3namespace nn::font::detail {
4
5class RuntimeTypeInfo {
6public:
7 const RuntimeTypeInfo* m_ParentTypeInfo;
8
9 explicit RuntimeTypeInfo(const RuntimeTypeInfo* parent) : m_ParentTypeInfo(parent) {}
10 bool IsDerivedFrom(const RuntimeTypeInfo*) const;
11};
12
13} // namespace nn::font::detail
14
15// todo: figure out where to put this
16#define NN_RUNTIME_TYPEINFO_BASE() \
17 static const nn::font::detail::RuntimeTypeInfo* GetRuntimeTypeInfoStatic() { \
18 static const nn::font::detail::RuntimeTypeInfo s_TypeInfo(nullptr); \
19 return &s_TypeInfo; \
20 } \
21 \
22 virtual const nn::font::detail::RuntimeTypeInfo* GetRuntimeTypeInfo() const { \
23 return GetRuntimeTypeInfoStatic(); \
24 }
25
26#define NN_RUNTIME_TYPEINFO(BASE) \
27 static const nn::font::detail::RuntimeTypeInfo* GetRuntimeTypeInfoStatic() { \
28 static const nn::font::detail::RuntimeTypeInfo s_TypeInfo( \
29 BASE::GetRuntimeTypeInfoStatic()); \
30 return &s_TypeInfo; \
31 } \
32 \
33 virtual const nn::font::detail::RuntimeTypeInfo* GetRuntimeTypeInfo() const { \
34 return GetRuntimeTypeInfoStatic(); \
35 }
36