|
NcEngine
|
Generic interface around component types. More...
#include <AnyComponent.h>
Public Member Functions | |
| constexpr | AnyComponent () noexcept |
| Construct a null AnyComponent. | |
| template<PooledComponent T> | |
| AnyComponent (T *instance, ComponentHandler< T > *handler) | |
| Construct an AnyComponent wrapper around a component. More... | |
| operator bool () const noexcept | |
| Check if this refers to a valid component. | |
| auto | operator== (const AnyComponent &other) const noexcept -> bool |
| Check if two AnyComponents refer to the same component. | |
| auto | operator!= (const AnyComponent &other) const noexcept -> bool |
| Check if two AnyComponents refer to different components. | |
| auto | Id () const -> size_t |
| Get the value of Componenthandler::id for the concrete component type. More... | |
| auto | Name () const -> std::string_view |
| Get the value of ComponentHandler::name for the concrete component type. More... | |
| auto | HasDrawUI () const -> bool |
| Check if ComponentHandler::drawUI is set for the concrete component type. More... | |
| void | DrawUI (ui::editor::EditorContext &ctx) |
| Invoke ComponentHandler::drawUI with the component instance, if it is set. | |
Generic interface around component types.
|
inlineexplicit |
Construct an AnyComponent wrapper around a component.
| T | The underlying component type. |
| instance | A valid pointer to the component instance. |
| handler | A valid pointer to the handler for T. |
| NcError | if either the instance or handler are null. |
|
inline |
Check if ComponentHandler::drawUI is set for the concrete component type.
| NcError | if invoked on a null AnyComponent. |
|
inline |
Get the value of Componenthandler::id for the concrete component type.
| NcError | if invoked on a null AnyComponent. |
|
inline |
Get the value of ComponentHandler::name for the concrete component type.
| NcError | if invoked on a null AnyComponent. |