SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
RttiBase.h
1#pragma once
2
3#include "spark/rtti/Export.h"
4
5#include "spark/base/Macros.h"
6
7#include <string>
8#include <vector>
9
10namespace spark::rtti
11{
15 class SPARK_RTTI_EXPORT RttiBase
16 {
17 public:
18 explicit RttiBase(std::string class_name);
19 virtual ~RttiBase() = default;
20
21 RttiBase(const RttiBase& other) = default;
22 RttiBase(RttiBase&& other) noexcept = default;
23 RttiBase& operator=(const RttiBase& other) = default;
24 RttiBase& operator=(RttiBase&& other) noexcept = default;
25
29 [[nodiscard]] std::string className() const;
30
34 [[nodiscard]] virtual std::vector<RttiBase*> parents() = 0;
35
41 [[nodiscard]] virtual bool isSubTypeOf(const RttiBase* potential_parent_type) = 0;
42
43 private:
44 // warning C4251: 'spark::rtti::RttiBase::m_className': class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'spark::rtti::RttiBase'
45 SPARK_SUPPRESS_MSVC_WARNING(4251)
46 std::string m_className;
47 };
48}
The abstract class used as base for the RTTI data.
Definition RttiBase.h:16
virtual std::vector< RttiBase * > parents()=0
virtual bool isSubTypeOf(const RttiBase *potential_parent_type)=0
Checks if the current RTTI inherits from a specific parent.