cubos::core::reflection::TypeRegistry class final

Stores a set of types which can be accessed by name.

Public functions

void insert(const Type& type)
Registers the given type.
void insert(const TypeRegistry& other)
Calls insert for each type in the given type registry.
template<typename T>
void insert()
Registers the given type.
auto contains(const Type& type) const -> bool
Checks if the given type is registered.
template<typename T>
auto contains() const -> bool
auto contains(const std::string& name) const -> bool
Checks if a type with the given name is registered.
auto at(const std::string& name) const -> const Type&
Returns the type with the given name.
auto size() const -> std::size_t
Returns the number of registered types.
auto begin() const -> Iterator
Gets an iterator to the beginning of the registry.
auto end() const -> Iterator
Gets an iterator to the end of the registry.

Function documentation

void cubos::core::reflection::TypeRegistry::insert(const Type& type)

Registers the given type.

Parameters
type Type to register.

Does nothing if the type is already registered. Aborts if a different type with the same name is already registered.

void cubos::core::reflection::TypeRegistry::insert(const TypeRegistry& other)

Calls insert for each type in the given type registry.

Parameters
other Type registry to copy types from.

template<typename T>
void cubos::core::reflection::TypeRegistry::insert()

Registers the given type.

Template parameters
T Type to register.

Does nothing if the type is already registered. Aborts if a different type with the same name is already registered.

bool cubos::core::reflection::TypeRegistry::contains(const Type& type) const

Checks if the given type is registered.

Parameters
type Type to check.
Returns Whether the given type is registered.

template<typename T>
bool cubos::core::reflection::TypeRegistry::contains() const

Template parameters
T Type to check.

bool cubos::core::reflection::TypeRegistry::contains(const std::string& name) const

Checks if a type with the given name is registered.

Parameters
name Name of the type.
Returns Whether a type with the given name is registered.

const Type& cubos::core::reflection::TypeRegistry::at(const std::string& name) const

Returns the type with the given name.

Parameters
name Name of the type.
Returns Type with the given name.

Aborts if contains(const std::string&) returns false.

std::size_t cubos::core::reflection::TypeRegistry::size() const

Returns the number of registered types.

Returns Number of registered types.

Iterator cubos::core::reflection::TypeRegistry::begin() const

Gets an iterator to the beginning of the registry.

Returns Iterator.

Iterator cubos::core::reflection::TypeRegistry::end() const

Gets an iterator to the end of the registry.

Returns Iterator.