guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
guillaume::ecs::EntityBuilderManager Class Reference

Holds one builder per builder type and hands them out by type. More...

#include <headers/guillaume/ecs/entity_builder_manager.hpp>

Inheritance diagram for guillaume::ecs::EntityBuilderManager:

Public Member Functions

template<InheritFromEntityBuilder BuilderType>
void addBuilder (ComponentRegistry &componentRegistry, EntityRegistry &entityRegistry)
 Create a builder of a given type and keep it.
 EntityBuilderManager (void)
 Create a manager with no builder.
virtual ~EntityBuilderManager (void)
 Destroy the manager and the builders it holds.
template<InheritFromEntityBuilder BuilderType>
BuilderType & getBuilder (void)
 Get the builder of a given type.

Detailed Description

Holds one builder per builder type and hands them out by type.

Each Scene has one, reached with Scene::getBuilderManager and filled with a builder for every widget of the library. This is how a scene creates its widgets:

auto &builder =
getBuilderManager().getBuilder<entities::Button::Builder>();
auto button = builder.makeButton(nullptr, "Save", [] {},
entities::Button::Color::Filled, entities::Button::Shape::Round,
entities::Button::Size::Medium, false);
Configures, creates and registers Button widgets.
Definition button.hpp:97
std::shared_ptr< Button > makeButton(std::shared_ptr< Entity > parent, const std::string &labelContent, std::function< void(void)> onClick, Color colorStyle, Shape shape, Size size, bool isMorph)
Build a button with a label and no icon, register it under parent and reset the builder.
Definition button.cpp:145
Note
A builder is shared by all its users: it keeps its options between calls until an entity is built, which resets it.
See also
EntityBuilder
EntityBuilderManagerFiller

Definition at line 55 of file entity_builder_manager.hpp.

Constructor & Destructor Documentation

◆ EntityBuilderManager()

guillaume::ecs::EntityBuilderManager::EntityBuilderManager ( void )

Create a manager with no builder.

Definition at line 27 of file entity_builder_manager.cpp.

◆ ~EntityBuilderManager()

guillaume::ecs::EntityBuilderManager::~EntityBuilderManager ( void )
virtual

Destroy the manager and the builders it holds.

Definition at line 31 of file entity_builder_manager.cpp.

Member Function Documentation

◆ addBuilder()

template<InheritFromEntityBuilder BuilderType>
void guillaume::ecs::EntityBuilderManager::addBuilder ( ComponentRegistry & componentRegistry,
EntityRegistry & entityRegistry )

Create a builder of a given type and keep it.

Template Parameters
BuilderTypeThe builder type to create, for instance entities::Button::Builder. It must be constructible from the two registries.
Parameters
componentRegistryThe registry in which the builder creates components. It must outlive the manager.
entityRegistryThe registry in which the builder registers entities. It must outlive the manager.
Exceptions
std::runtime_errorWhen the manager already holds a builder of that type.

◆ getBuilder()

template<InheritFromEntityBuilder BuilderType>
BuilderType & guillaume::ecs::EntityBuilderManager::getBuilder ( void )

Get the builder of a given type.

Template Parameters
BuilderTypeThe builder type to get, for instance entities::Button::Builder.
Returns
Reference to the builder, valid as long as the manager.
Exceptions
std::runtime_errorWhen no builder of that type was added.

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