Manages the components within nkWinUi. More...
Public Member Functions | |
System * | getSystem () const |
Component * | createOrRetrieve (nkMemory::StringView name, COMPONENT_TYPE componentType) |
Component * | record (nkMemory::StringView name, nkMemory::UniquePtr< Component > resource) |
Component * | get (nkMemory::StringView name) const |
Component * | getByIndex (unsigned int index) const |
void | rename (nkMemory::StringView currentName, nkMemory::StringView newName) |
void | erase (nkMemory::StringView name) |
nkMemory::UniquePtr< Component > | relinquish (nkMemory::StringView name) |
Manages the components within nkWinUi.
Responsible for creating and book-keeping them. At all time, the manager is responsible for the memory allocated inside it.
System* nkWinUi::ComponentManager::getSystem | ( | ) | const |
Component* nkWinUi::ComponentManager::createOrRetrieve | ( | nkMemory::StringView | name, |
COMPONENT_TYPE | componentType | ||
) |
Creates (if unavailable) or retrieves (if available) component attached to passed name.
name | The name, aka identifier, of the component to create or retrieve. |
componentType | The type the component should be. |
Component* nkWinUi::ComponentManager::record | ( | nkMemory::StringView | name, |
nkMemory::UniquePtr< Component > | resource | ||
) |
Records an already existing resource in the manager, passing its ownership around.
name | The name under which the resource should be recorded. |
resource | The resource to record. |
Component* nkWinUi::ComponentManager::get | ( | nkMemory::StringView | name | ) | const |
Returns a component attached to a name, if available.
name | The name of the component that should be retrieved. |
Component* nkWinUi::ComponentManager::getByIndex | ( | unsigned int | index | ) | const |
Returns the component at given index, if available.
index | The index of the component to retrieve. |
void nkWinUi::ComponentManager::rename | ( | nkMemory::StringView | currentName, |
nkMemory::StringView | newName | ||
) |
Renames a component.
currentName | The name of the component to rename. |
newName | The name to reassign to the component. |
void nkWinUi::ComponentManager::erase | ( | nkMemory::StringView | name | ) |
Erases a component. Memory attached to it will be freed.
name | The name identifying the component to erase. |
nkMemory::UniquePtr<Component> nkWinUi::ComponentManager::relinquish | ( | nkMemory::StringView | name | ) |
Requests the manager to relinquish the ownership of a resource and pass it around.
name | The name of the recorded resource to relinquish. |