You.i Engine
YiRttiRegistry.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_RTTI_REGISTRY_H_
3 #define _YI_RTTI_REGISTRY_H_
4 
5 #include "utility/YiRtti.h"
7 
8 #include <map>
9 #include <unordered_map>
10 
24 {
25 public:
29  static CYIRTTIRegistry &GetInstance();
30 
42  void RegisterType(const CYIRuntimeTypeInfo &typeInfo, CYIString name);
43 
50 
58  void UnregisterType(CYIStringView name);
59 
65  const CYIRuntimeTypeInfo *GetTypeForName(CYIStringView typeName) const;
66 
72  std::map<CYIString, const CYIRuntimeTypeInfo *> GetRegisteredTypes() const;
73 
79  std::vector<const CYIRuntimeTypeInfo *> GetSuperclassesTypeInfos(const CYIRuntimeTypeInfo &type, bool directSuperclassesOnly = false) const;
80 
86  std::vector<const CYIRuntimeTypeInfo *> GetSubclassesTypeInfos(const CYIRuntimeTypeInfo &type, bool directSubclassesOnly = false) const;
87 
93  std::vector<const CYIRuntimeTypeInfo *> GetRootTypeInfos() const;
94 
115  CYIString GenerateInheritanceTreeString(const CYIRuntimeTypeInfo &type, bool useASCII = false, CYIStringView textColor = "", CYIStringView graphColor = "", CYIStringView noticeColor = "") const;
116 
117 private:
118  CYIRTTIRegistry();
119 
120  std::unordered_map<CYIStringUnorderedContainerKey, const CYIRuntimeTypeInfo *> m_types;
121 
123 };
124 
127 #endif
CYIString GenerateInheritanceTreeString(const CYIRuntimeTypeInfo &type, bool useASCII=false, CYIStringView textColor="", CYIStringView graphColor="", CYIStringView noticeColor="") const
std::vector< const CYIRuntimeTypeInfo * > GetSubclassesTypeInfos(const CYIRuntimeTypeInfo &type, bool directSubclassesOnly=false) const
#define YI_DISALLOW_COPY_AND_ASSIGN(TypeName)
Delete the copy constructor and assignment operator (and consequently the move constructor as well) ...
Definition: YiPredef.h:122
std::vector< const CYIRuntimeTypeInfo * > GetSuperclassesTypeInfos(const CYIRuntimeTypeInfo &type, bool directSuperclassesOnly=false) const
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:36
static CYIRTTIRegistry & GetInstance()
const CYIRuntimeTypeInfo & RegisterTypeHelper(const CYIRuntimeTypeInfo &typeInfo)
void RegisterType(const CYIRuntimeTypeInfo &typeInfo, CYIString name)
The abstract runtime representation of a C++ type.
Definition: YiRtti.h:56
const CYIRuntimeTypeInfo * GetTypeForName(CYIStringView typeName) const
std::map< CYIString, const CYIRuntimeTypeInfo * > GetRegisteredTypes() const
A registry of all known RTTI types.
Definition: YiRttiRegistry.h:23
This file contains the classes and macros used to implement RTTI in You.i Engine. ...
std::vector< const CYIRuntimeTypeInfo * > GetRootTypeInfos() const
void UnregisterType(CYIStringView name)
A lightweight wrapper around a sequence of Unicode characters.
Definition: YiStringView.h:57