CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::Class Class Reference

#include <CeresEngine/Reflection/Class.hpp>

Inheritance diagram for CeresEngine::Class:
CeresEngine::MetaContainer CeresEngine::TClass< T >

Public Types

using CastFunctionType = const void *(*)(const void *)
 
template<typename T >
using MemberIterator = Generator< const T >
 
template<typename T >
using MemberIteratorFunc = FunctionView< bool(const T &) const >
 

Public Member Functions

 Class (const StringView name)
 
 ~Class () override=default
 
Generator< const ClassforEachDirectBase () const
 
Generator< const ClassforEachBase () const
 
bool inheritedFrom (const Class *base) const
 
void forEachConstructor (const MemberIteratorFunc< ClassConstructor > &func) const
 Enumerates over all constructors in the class.
 
MemberIterator< ClassConstructorforEachConstructor () const
 Enumerates over all constructors in the class.
 
template<typename... Args>
const ClassConstructorgetConstructor () const
 
const ClassConstructorgetConstructor (StringView oldSignature) const
 
const ClassConstructorgetDefaultConstructor () const
 
const ClassConstructorgetCopyConstructor () const
 
const ClassConstructorgetMoveConstructor () const
 
void forEachProperty (const MemberIteratorFunc< ClassProperty > &func) const
 Enumerates over all properties in the class.
 
void forEachProperty (const MetaMemberIterationFlags &flags, const MemberIteratorFunc< ClassProperty > &func) const
 Enumerates over all properties in the class.
 
MemberIterator< ClassPropertyforEachProperty (MetaMemberIterationFlags flags=MetaMemberIterationFlag::Default) const
 Enumerates over all properties in the class.
 
const ClassPropertygetProperty (StringView name) const
 
void forEachMethod (const MemberIteratorFunc< ClassMethod > &func) const
 Enumerates over all methods in the class.
 
void forEachMethod (const MetaMemberIterationFlags &flags, const MemberIteratorFunc< ClassMethod > &func) const
 Enumerates over all methods in the class.
 
MemberIterator< ClassMethodforEachMethod (MetaMemberIterationFlags flags=MetaMemberIterationFlag::Default) const
 Enumerates over all methods in the class.
 
template<typename... Args>
const ClassMethodgetMethod (StringView name) const
 
const voidcast (const Class *base, const void *instance) const
 
voidcast (const Class *base, void *instance) const
 
- Public Member Functions inherited from CeresEngine::MetaContainer
template<typename T , typename Func >
void forEach (Func &&func) const
 
template<typename Func >
void forEach (MetaCategory category, Func &&func) const
 
template<typename T >
Generator< const TforEach () const
 
Generator< const MetaItemforEach (MetaCategory category) const
 

Static Public Member Functions

static const Classfind (TypeID typeID)
 Finds a Class by it's type ID.
 
static const Classfind (StringView name)
 Finds a Class by it's fully qualified name.
 

Public Attributes

const StringView name
 
ReflectionAttributeContainer attributes
 

Protected Member Functions

void addBaseClass (TypeID typeID, CastFunctionType caster)
 
- Protected Member Functions inherited from CeresEngine::MetaContainer
 MetaContainer ()=default
 
virtual ~MetaContainer ()=default
 
bool addItem (MetaItem *value)
 
std::size_t count (MetaCategory category) const
 

Private Member Functions

const ClassMethodgetMethodInternal (StringView name) const
 
const ClassPropertygetPropertyInternal (StringView name) const
 

Private Attributes

HashMap< TypeID, CastFunctionTypemBaseClasses
 

Member Typedef Documentation

◆ CastFunctionType

◆ MemberIterator

◆ MemberIteratorFunc

Constructor & Destructor Documentation

◆ Class()

CeresEngine::Class::Class ( const StringView  name)
inlineexplicit

◆ ~Class()

CeresEngine::Class::~Class ( )
overridedefault

Member Function Documentation

◆ addBaseClass()

void CeresEngine::Class::addBaseClass ( TypeID  typeID,
CastFunctionType  caster 
)
protected

◆ cast() [1/2]

const void * CeresEngine::Class::cast ( const Class base,
const void instance 
) const

◆ cast() [2/2]

void * CeresEngine::Class::cast ( const Class base,
void instance 
) const

◆ find() [1/2]

static const Class * CeresEngine::Class::find ( StringView  name)
static

Finds a Class by it's fully qualified name.

◆ find() [2/2]

static const Class * CeresEngine::Class::find ( TypeID  typeID)
static

Finds a Class by it's type ID.

◆ forEachBase()

Generator< const Class > CeresEngine::Class::forEachBase ( ) const

◆ forEachConstructor() [1/2]

MemberIterator< ClassConstructor > CeresEngine::Class::forEachConstructor ( ) const

Enumerates over all constructors in the class.

◆ forEachConstructor() [2/2]

void CeresEngine::Class::forEachConstructor ( const MemberIteratorFunc< ClassConstructor > &  func) const

Enumerates over all constructors in the class.

Parameters
funcA function that iterates over the constructors. Can optionally return a false-like value to stop iteration.

◆ forEachDirectBase()

Generator< const Class > CeresEngine::Class::forEachDirectBase ( ) const

◆ forEachMethod() [1/3]

void CeresEngine::Class::forEachMethod ( const MemberIteratorFunc< ClassMethod > &  func) const
inline

Enumerates over all methods in the class.

Parameters
funcA function that iterates over the methods. Can optionally return a false-like value to stop iteration.

◆ forEachMethod() [2/3]

void CeresEngine::Class::forEachMethod ( const MetaMemberIterationFlags flags,
const MemberIteratorFunc< ClassMethod > &  func 
) const

Enumerates over all methods in the class.

Parameters
funcA function that iterates over the methods. Can optionally return a false-like value to stop iteration.

◆ forEachMethod() [3/3]

MemberIterator< ClassMethod > CeresEngine::Class::forEachMethod ( MetaMemberIterationFlags  flags = MetaMemberIterationFlag::Default) const

Enumerates over all methods in the class.

◆ forEachProperty() [1/3]

void CeresEngine::Class::forEachProperty ( const MemberIteratorFunc< ClassProperty > &  func) const
inline

Enumerates over all properties in the class.

Parameters
funcA function that iterates over the properties. Can optionally return a false-like value to stop iteration.

◆ forEachProperty() [2/3]

void CeresEngine::Class::forEachProperty ( const MetaMemberIterationFlags flags,
const MemberIteratorFunc< ClassProperty > &  func 
) const

Enumerates over all properties in the class.

Parameters
funcA function that iterates over the properties. Can optionally return a false-like value to stop iteration.

◆ forEachProperty() [3/3]

MemberIterator< ClassProperty > CeresEngine::Class::forEachProperty ( MetaMemberIterationFlags  flags = MetaMemberIterationFlag::Default) const

Enumerates over all properties in the class.

◆ getConstructor() [1/2]

template<typename... Args>
const ClassConstructor * CeresEngine::Class::getConstructor ( ) const

◆ getConstructor() [2/2]

const ClassConstructor * CeresEngine::Class::getConstructor ( StringView  oldSignature) const

◆ getCopyConstructor()

const ClassConstructor * CeresEngine::Class::getCopyConstructor ( ) const

◆ getDefaultConstructor()

const ClassConstructor * CeresEngine::Class::getDefaultConstructor ( ) const

◆ getMethod()

template<typename... Args>
const ClassMethod * CeresEngine::Class::getMethod ( StringView  name) const

◆ getMethodInternal()

const ClassMethod * CeresEngine::Class::getMethodInternal ( StringView  name) const
private

◆ getMoveConstructor()

const ClassConstructor * CeresEngine::Class::getMoveConstructor ( ) const

◆ getProperty()

const ClassProperty * CeresEngine::Class::getProperty ( StringView  name) const

◆ getPropertyInternal()

const ClassProperty * CeresEngine::Class::getPropertyInternal ( StringView  name) const
private

◆ inheritedFrom()

bool CeresEngine::Class::inheritedFrom ( const Class base) const

Member Data Documentation

◆ attributes

ReflectionAttributeContainer CeresEngine::Class::attributes

◆ mBaseClasses

HashMap<TypeID, CastFunctionType> CeresEngine::Class::mBaseClasses
private

◆ name

const StringView CeresEngine::Class::name

The documentation for this class was generated from the following file: