Flecs: flecs::entity_builder< Self > Struct Template Reference
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.0 A fast entity component system (ECS) for C & C++

Loading...
Searching...
No Matches
flecs::entity_builder< Self > Struct Template Reference
C++ API » Core » Entities

Entity builder. More...

`#include <builder.hpp>`

Inheritance diagram for flecs::entity_builder< Self >:
[legend]

## Public Member Functions
template<typename T>
const Self & | add () const
| Add a component to an entity.
template<typename E, if_t< is_enum< E >::value > = 0>
const Self & | add (E value) const
| Add pair for enum constant.
const Self & | add (id_t component) const
| Add an entity to an entity.
const Self & | add (entity_t first, entity_t second) const
| Add a pair.
template<typename First, typename Second>
const Self & | add () const
| Add a pair.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
const Self & | add (Second second) const
| Add a pair.
template<typename First, typename Second, if_t< is_enum< Second >::value &&!std::is_same< First, Second >::value > = 0>
const Self & | add (Second constant) const
| Add a pair.
template<typename Second>
const Self & | add_second (flecs::entity_t first) const
| Add a pair.
const Self & | add_if (bool cond, flecs::id_t component) const
| Conditional add.
template<typename T>
const Self & | add_if (bool cond) const
| Conditional add.
const Self & | add_if (bool cond, flecs::entity_t first, flecs::entity_t second) const
| Conditional add.
template<typename First>
const Self & | add_if (bool cond, flecs::entity_t second) const
| Conditional add.
template<typename First, typename Second>
const Self & | add_if (bool cond) const
| Conditional add.
template<typename E, if_t< is_enum< E >::value > = 0>
const Self & | add_if (bool cond, E constant) const
| Conditional add.
const Self & | is_a (entity_t second) const
| Shortcut for add(IsA, entity).
template<typename T>
const Self & | is_a () const
| Shortcut for add(IsA, entity).
const Self & | child_of (entity_t second) const
| Shortcut for add(ChildOf, entity).
const Self & | depends_on (entity_t second) const
| Shortcut for add(DependsOn, entity).
template<typename E, if_t< is_enum< E >::value > = 0>
const Self & | depends_on (E second) const
| Shortcut for add(DependsOn, entity).
const Self & | slot_of (entity_t second) const
| Shortcut for add(SlotOf, entity).
const Self & | slot () const
| Shortcut for add(SlotOf, target(ChildOf)).
template<typename T>
const Self & | child_of () const
| Shortcut for add(ChildOf, entity).
template<typename T>
const Self & | depends_on () const
| Shortcut for add(DependsOn, entity).
template<typename T>
const Self & | slot_of () const
| Shortcut for add(SlotOf, entity).
template<typename T>
const Self & | remove () const
| Remove a component from an entity.
const Self & | remove (entity_t entity) const
| Remove an entity from an entity.
const Self & | remove (entity_t first, entity_t second) const
| Remove a pair.
template<typename First, typename Second>
const Self & | remove () const
| Removes a pair.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
const Self & | remove (Second second) const
| Remove a pair.
template<typename Second>
const Self & | remove_second (flecs::entity_t first) const
| Removes a pair.
template<typename First, typename Second, if_t< is_enum< Second >::value > = 0>
const Self & | remove (Second constant) const
| Remove a pair.
const Self & | auto_override (flecs::id_t id) const
| Mark id for auto-overriding.
const Self & | auto_override (flecs::entity_t first, flecs::entity_t second) const
| Mark pair for auto-overriding.
template<typename T>
const Self & | auto_override () const
| Mark component for auto-overriding.
template<typename First>
const Self & | auto_override (flecs::entity_t second) const
| Mark pair for auto-overriding.
template<typename First, typename Second>
const Self & | auto_override () const
| Mark pair for auto-overriding.
template<typename T>
const Self & | set_auto_override (const T &val) const
| Set component, mark component for auto-overriding.
template<typename T>
const Self & | set_auto_override (T &&val) const
| Set component, mark component for auto-overriding.
template<typename First>
const Self & | set_auto_override (flecs::entity_t second, const First &val) const
| Set pair, mark component for auto-overriding.
template<typename First>
const Self & | set_auto_override (flecs::entity_t second, First &&val) const
| Set pair, mark component for auto-overriding.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
const Self & | set_auto_override (const A &val) const
| Set component, mark component for auto-overriding.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
const Self & | set_auto_override (A &&val) const
| Set component, mark component for auto-overriding.
template<typename T, typename ... Args>
const Self & | emplace_auto_override (Args &&... args) const
| Emplace component, mark component for auto-overriding.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0, typename ... Args>
const Self & | emplace_auto_override (Args &&... args) const
| Emplace pair, mark pair for auto-overriding.
const Self & | enable () const
| Enable an entity.
const Self & | disable () const
| Disable an entity.
const Self & | enable (flecs::id_t id, bool toggle=true) const
| Enable an id.
template<typename T>
const Self & | enable () const
| Enable a component.
const Self & | enable (flecs::id_t first, flecs::id_t second) const
| Enable a pair.
template<typename First>
const Self & | enable (flecs::id_t second) const
| Enable a pair.
template<typename First, typename Second>
const Self & | enable () const
| Enable a pair.
const Self & | disable (flecs::id_t id) const
| Disable an id.
template<typename T>
const Self & | disable () const
| Disable a component.
const Self & | disable (flecs::id_t first, flecs::id_t second) const
| Disable a pair.
template<typename First>
const Self & | disable (flecs::id_t second) const
| Disable a pair.
template<typename First, typename Second>
const Self & | disable () const
| Disable a pair.
const Self & | set_ptr (entity_t comp, size_t size, const void *ptr) const
const Self & | set_ptr (entity_t comp, const void *ptr) const
template<typename T, if_t< is_actual< T >::value > = 0>
const Self & | set (T &&value) const
| Set a component for an entity.
template<typename T, if_t< is_actual< T >::value > = 0>
const Self & | set (const T &value) const
| Set a component for an entity.
template<typename T, typename A = actual_type_t<T>, if_not_t< is_actual< T >::value > = 0>
const Self & | set (A &&value) const
| Set a component for an entity.
template<typename T, typename A = actual_type_t<T>, if_not_t< is_actual< T >::value > = 0>
const Self & | set (const A &value) const
| Set a component for an entity.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
const Self & | set (A &&value) const
| Set a pair for an entity.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
const Self & | set (const A &value) const
| Set a pair for an entity.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
const Self & | set (Second second, const First &value) const
| Set a pair for an entity.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
const Self & | set (Second second, First &&value) const
| Set a pair for an entity.
template<typename First, typename Second, if_t< is_enum< Second >::value > = 0>
const Self & | set (Second constant, const First &value) const
| Set a pair for an entity.
template<typename Second>
const Self & | set_second (entity_t first, const Second &value) const
| Set a pair for an entity.
template<typename Second>
const Self & | set_second (entity_t first, Second &&value) const
| Set a pair for an entity.
template<typename First, typename Second>
const Self & | set_second (const Second &value) const
| Set a pair for an entity.
template<typename T, if_t< is_actual< T >::value > = 0>
const Self & | assign (T &&value) const
| Assign a component for an entity.
template<typename T, if_t< is_actual< T >::value > = 0>
const Self & | assign (const T &value) const
| Assign a component for an entity.
template<typename T, typename A = actual_type_t<T>, if_not_t< is_actual< T >::value > = 0>
const Self & | assign (A &&value) const
| Assign a component for an entity.
template<typename T, typename A = actual_type_t<T>, if_not_t< is_actual< T >::value > = 0>
const Self & | assign (const A &value) const
| Assign a component for an entity.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
const Self & | assign (A &&value) const
| Assign a pair for an entity.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
const Self & | assign (const A &value) const
| Assign a pair for an entity.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
const Self & | assign (Second second, const First &value) const
| Assign a pair for an entity.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
const Self & | assign (Second second, First &&value) const
| Assign a pair for an entity.
template<typename First, typename Second, if_t< is_enum< Second >::value > = 0>
const Self & | assign (Second constant, const First &value) const
| Assign a pair for an entity.
template<typename Second>
const Self & | assign_second (entity_t first, const Second &value) const
| Assign a pair for an entity.
template<typename Second>
const Self & | assign_second (entity_t first, Second &&value) const
| Assign a pair for an entity.
template<typename First, typename Second>
const Self & | assign_second (const Second &value) const
template<typename Func>
const Self & | insert (const Func &func) const
| Set 1..N components.
template<typename T, typename ... Args, typename A = actual_type_t<T>>
const Self & | emplace (Args &&... args) const
| Emplace component.
template<typename First, typename Second, typename ... Args, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
const Self & | emplace (Args &&... args) const
template<typename First, typename ... Args>
const Self & | emplace_first (flecs::entity_t second, Args &&... args) const
template<typename Second, typename ... Args>
const Self & | emplace_second (flecs::entity_t first, Args &&... args) const
template<typename Func>
const Self & | with (const Func &func) const
| Entities created in function will have the current entity.
template<typename First, typename Func>
const Self & | with (const Func &func) const
| Entities created in function will have (First, this).
template<typename Func>
const Self & | with (entity_t first, const Func &func) const
| Entities created in function will have (first, this).
template<typename Func>
const Self & | scope (const Func &func) const
| The function will be ran with the scope set to the current entity.
scoped_world | scope () const
| Return world scoped to entity.
const Self & | set_name (const char *name) const
const Self & | set_alias (const char *name) const
const Self & | set_doc_name (const char *name) const
| Set human readable name.
const Self & | set_doc_brief (const char *brief) const
| Set brief description.
const Self & | set_doc_detail (const char *detail) const
| Set detailed description.
const Self & | set_doc_link (const char *link) const
| Set link to external documentation.
const Self & | set_doc_color (const char *color) const
| Set doc color.
const Self & | set_doc_uuid (const char *uuid) const
| Set doc UUID.
const Self & | set_json (flecs::id_t e, const char *json, flecs::from_json_desc_t *desc=nullptr) const
| Set component from JSON.
const Self & | set_json (flecs::entity_t r, flecs::entity_t t, const char *json, flecs::from_json_desc_t *desc=nullptr) const
| Set pair from JSON.
template<typename T>
const Self & | set_json (const char *json, flecs::from_json_desc_t *desc=nullptr) const
| Set component from JSON.
template<typename R, typename T>
const Self & | set_json (const char *json, flecs::from_json_desc_t *desc=nullptr) const
| Set pair from JSON.
template<typename R>
const Self & | set_json (flecs::entity_t t, const char *json, flecs::from_json_desc_t *desc=nullptr) const
| Set pair from JSON.
template<typename T>
const Self & | set_json_second (flecs::entity_t r, const char *json, flecs::from_json_desc_t *desc=nullptr) const
| Set pair from JSON.
template<typename Func>
const Self & | observe (flecs::entity_t evt, Func &&callback) const
| Observe event on entity.
template<typename Evt, typename Func>
const Self & | observe (Func &&callback) const
| Observe event on entity.
template<typename Func>
const Self & | observe (Func &&callback) const
| Observe event on entity.
const Self & | set_doc_name (const char *name) const
| Set human readable name.
const Self & | set_doc_brief (const char *brief) const
| Set brief description.
const Self & | set_doc_detail (const char *detail) const
| Set detailed description.
const Self & | set_doc_link (const char *link) const
| Set link to external documentation.
const Self & | set_doc_color (const char *color) const
| Set doc color.
const Self & | set_doc_uuid (const char *uuid) const
| Set doc UUID.
template<typename Func>
const Self & | observe (flecs::entity_t evt, Func &&callback) const
| Observe event on entity.
template<typename Evt, typename Func>
const Self & | observe (Func &&callback) const
| Observe event on entity.
template<typename Func>
const Self & | observe (Func &&callback) const
| Observe event on entity.
const Self & | set_json (flecs::id_t e, const char *json, flecs::from_json_desc_t *desc=nullptr) const
| Set component from JSON.
const Self & | set_json (flecs::entity_t r, flecs::entity_t t, const char *json, flecs::from_json_desc_t *desc=nullptr) const
| Set pair from JSON.
template<typename T>
const Self & | set_json (const char *json, flecs::from_json_desc_t *desc=nullptr) const
| Set component from JSON.
template<typename R, typename T>
const Self & | set_json (const char *json, flecs::from_json_desc_t *desc=nullptr) const
| Set pair from JSON.
template<typename R>
const Self & | set_json (flecs::entity_t t, const char *json, flecs::from_json_desc_t *desc=nullptr) const
| Set pair from JSON.
template<typename T>
const Self & | set_json_second (flecs::entity_t r, const char *json, flecs::from_json_desc_t *desc=nullptr) const
| Set pair from JSON.
| entity_view ()
| entity_view (flecs::world_t *world, flecs::id_t id)
| Wrap an existing entity id.
| entity_view (entity_t id)
| Implicit conversion from flecs::entity_t to flecs::entity_view.
Public Member Functions inherited from flecs::entity_view
| entity_view (flecs::world_t *world, flecs::id_t id)
| Wrap an existing entity id.
| entity_view (entity_t id)
| Implicit conversion from flecs::entity_t to flecs::entity_view.
entity_t | id () const
| Get entity id.
bool | is_valid () const
| Check if entity is valid.
| operator bool () const
bool | is_alive () const
| Check if entity is alive.
flecs::string_view | name () const
| Return the entity name.
flecs::string_view | symbol () const
| Return the entity symbol.
flecs::string | path (const char *sep="::", const char *init_sep="::") const
| Return the entity path.
flecs::string | path_from (flecs::entity_t parent, const char *sep="::", const char *init_sep="::") const
| Return the entity path relative to a parent.
template<typename Parent>
flecs::string | path_from (const char *sep="::", const char *init_sep="::") const
| Return the entity path relative to a parent.
bool | enabled () const
flecs::type | type () const
| Get the entity's type.
flecs::table | table () const
| Get the entity's table.
flecs::table_range | range () const
| Get table range for the entity.
template<typename Func>
void | each (const Func &func) const
| Iterate (component) ids of an entity.
template<typename Func>
void | each (flecs::id_t first, flecs::id_t second, const Func &func) const
| Iterate matching pair ids of an entity.
template<typename Func>
void | each (const flecs::entity_view &rel, const Func &func) const
| Iterate targets for a given relationship.
template<typename First, typename Func>
void | each (const Func &func) const
| Iterate targets for a given relationship.
template<typename Func>
void | children (flecs::entity_t rel, Func &&func) const
| Iterate children for entity.
template<typename Rel, typename Func>
void | children (Func &&func) const
| Iterate children for entity.
template<typename Func>
void | children (Func &&func) const
| Iterate children for entity.
template<typename T, if_t< is_actual< T >::value > = 0>
const T * | try_get () const
| Get component value.
template<typename T, typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>
const A * | try_get () const
| Get component value.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
const A * | try_get () const
| Get a pair.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
const First * | try_get (Second second) const
| Get a pair.
template<typename First, typename Second, if_t< is_enum< Second >::value &&!std::is_same< First, Second >::value > = 0>
const First * | try_get (Second constant) const
| Get a pair.
const void * | try_get (flecs::id_t comp) const
| Get component value (untyped).
const void * | try_get (flecs::entity_t first, flecs::entity_t second) const
| Get a pair (untyped).
template<typename Second>
const Second * | try_get_second (flecs::entity_t first) const
| Get the second part for a pair.
template<typename First, typename Second>
const Second * | try_get_second () const
| Get the second part for a pair.
template<typename T, if_t< is_actual< T >::value > = 0>
const T & | get () const
| Get component value.
template<typename T, typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>
const A & | get () const
| Get component value.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
const A & | get () const
| Get a pair.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
const First & | get (Second second) const
| Get a pair.
template<typename First, typename Second, if_t< is_enum< Second >::value &&!std::is_same< First, Second >::value > = 0>
const First & | get (Second constant) const
| Get a pair.
const void * | get (flecs::id_t comp) const
| Get component value (untyped).
const void * | get (flecs::entity_t first, flecs::entity_t second) const
| Get a pair (untyped).
template<typename Func, if_t< is_callable< Func >::value > = 0>
bool | get (const Func &func) const
| Get 1..N components.
template<typename Second>
const Second & | get_second (flecs::entity_t first) const
| Get the second part for a pair.
template<typename First, typename Second>
const Second & | get_second () const
| Get the second part for a pair.
template<typename T, if_t< is_actual< T >::value > = 0>
T * | try_get_mut () const
| Get mutable component value.
template<typename T, typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>
A * | try_get_mut () const
| Get mutable component value.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
A * | try_get_mut () const
| Get a mutable pair.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
First * | try_get_mut (Second second) const
| Get a mutable pair.
template<typename First, typename Second, if_t< is_enum< Second >::value &&!std::is_same< First, Second >::value > = 0>
First * | try_get_mut (Second constant) const
| Get a mutable pair.
void * | try_get_mut (flecs::id_t comp) const
| Get mutable component value (untyped).
void * | try_get_mut (flecs::entity_t first, flecs::entity_t second) const
| Get a mutable pair (untyped).
template<typename Second>
Second * | try_get_mut_second (flecs::entity_t first) const
| Get the second part for a pair.
template<typename First, typename Second>
Second * | try_get_mut_second () const
| Get the second part for a pair.
template<typename T, if_t< is_actual< T >::value > = 0>
T & | get_mut () const
| Get mutable component value.
template<typename T, typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>
A & | get_mut () const
| Get mutable component value.
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>
A & | get_mut () const
| Get a mutable pair.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
First & | get_mut (Second second) const
| Get a mutable pair.
template<typename First, typename Second, if_t< is_enum< Second >::value &&!std::is_same< First, Second >::value > = 0>
First & | get_mut (Second constant) const
| Get a mutable pair.
void * | get_mut (flecs::id_t comp) const
| Get mutable component value (untyped).
void * | get_mut (flecs::entity_t first, flecs::entity_t second) const
| Get a mutable pair (untyped).
template<typename Second>
Second & | get_mut_second (flecs::entity_t first) const
| Get the second part for a pair.
template<typename First, typename Second>
Second * | get_mut_second () const
| Get the second part for a pair.
template<typename Enum>
Enum | get_constant () const
| Get enum constant for enum relationship.
template<typename First>
flecs::entity | target (int32_t index=0) const
| Get target for a given pair.
flecs::entity | target (flecs::entity_t first, int32_t index=0) const
| Get target for a given pair.
flecs::entity | target_for (flecs::entity_t relationship, flecs::id_t id) const
| Get the target of a pair for a given relationship id.
template<typename T>
flecs::entity | target_for (flecs::entity_t relationship) const
template<typename First, typename Second>
flecs::entity | target_for (flecs::entity_t relationship) const
int32_t | depth (flecs::entity_t rel) const
| Get depth for given relationship.
template<typename Rel>
int32_t | depth () const
| Get depth for given relationship.
flecs::entity | parent () const
| Get parent of entity.
flecs::entity | lookup (const char *path, bool search_path=false) const
| Lookup an entity by name.
bool | has (flecs::id_t e) const
| Check if entity has the provided entity.
template<typename T>
bool | has () const
| Check if entity has the provided component.
template<typename E, if_t< is_enum< E >::value > = 0>
bool | has (E value) const
| Check if entity has the provided enum constant.
template<typename First, typename Second>
bool | has () const
| Check if entity has the provided pair.
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>
bool | has (Second second) const
| Check if entity has the provided pair.
template<typename Second>
bool | has_second (flecs::entity_t first) const
| Check if entity has the provided pair.
template<typename First, typename E, if_t< is_enum< E >::value &&!std::is_same< First, E >::value > = 0>
bool | has (E value) const
| Check if entity has the provided pair.
bool | has (flecs::id_t first, flecs::id_t second) const
| Check if entity has the provided pair.
bool | owns (flecs::id_t e) const
| Check if entity owns the provided entity.
template<typename First>
bool | owns (flecs::id_t second) const
| Check if entity owns the provided pair.
bool | owns (flecs::id_t first, flecs::id_t second) const
| Check if entity owns the provided pair.
template<typename T>
bool | owns () const
| Check if entity owns the provided component.
template<typename First, typename Second>
bool | owns () const
| Check if entity owns the provided pair.
bool | enabled (flecs::id_t id) const
| Test if id is enabled.
template<typename T>
bool | enabled () const
| Test if component is enabled.
bool | enabled (flecs::id_t first, flecs::id_t second) const
| Test if pair is enabled.
template<typename First>
bool | enabled (flecs::id_t second) const
| Test if pair is enabled.
template<typename First, typename Second>
bool | enabled () const
| Test if pair is enabled.
flecs::entity | clone (bool clone_value=true, flecs::entity_t dst_id=0) const
flecs::entity | mut (const flecs::world &stage) const
| Return mutable entity handle for current stage When an entity handle created from the world is used while the world is in staged mode, it will only allow for readonly operations since structural changes are not allowed on the world while in staged mode.
flecs::entity | mut (const flecs::iter &it) const
| Same as mut(world), but for iterator.
flecs::entity | mut (const flecs::entity_view &e) const
| Same as mut(world), but for entity.
flecs::string | to_json (const flecs::entity_to_json_desc_t *desc=nullptr) const
| Serialize entity to JSON.
const char * | doc_name () const
| Get human readable name.
const char * | doc_brief () const
| Get brief description.
const char * | doc_detail () const
| Get detailed description.
const char * | doc_link () const
| Get link to external documentation.
const char * | doc_color () const
| Get color.
const char * | doc_uuid () const
| Get UUID.
int32_t | alert_count (flecs::entity_t alert=0) const
| Return number of alerts for entity.
template<typename E>
E | to_constant () const
| Convert entity to enum constant.
void | emit (flecs::entity_t evt) const
| Emit event for entity.
void | emit (flecs::entity evt) const
| Emit event for entity.
template<typename Evt, if_t< is_empty< Evt >::value > = 0>
void | emit () const
| Emit event for entity.
template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>
void | emit (const Evt &payload) const
| Emit event with payload for entity.
void | enqueue (flecs::entity_t evt) const
| Enqueue event for entity.
void | enqueue (flecs::entity evt) const
| Enqueue event for entity.
template<typename Evt, if_t< is_empty< Evt >::value > = 0>
void | enqueue () const
| Enqueue event for entity.
template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>
void | enqueue (const Evt &payload) const
| Enqueue event with payload for entity.
int32_t | alert_count (flecs::entity_t alert=0) const
| Return number of alerts for entity.
const char * | doc_name () const
| Get human readable name.
const char * | doc_brief () const
| Get brief description.
const char * | doc_detail () const
| Get detailed description.
const char * | doc_link () const
| Get link to external documentation.
const char * | doc_color () const
| Get color.
const char * | doc_uuid () const
| Get UUID.
template<typename E>
E | to_constant () const
| Convert entity to enum constant.
void | emit (flecs::entity_t evt) const
| Emit event for entity.
void | emit (flecs::entity evt) const
| Emit event for entity.
template<typename Evt, if_t< is_empty< Evt >::value > = 0>
void | emit () const
| Emit event for entity.
template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>
void | emit (const Evt &payload) const
| Emit event with payload for entity.
void | enqueue (flecs::entity_t evt) const
| Enqueue event for entity.
void | enqueue (flecs::entity evt) const
| Enqueue event for entity.
template<typename Evt, if_t< is_empty< Evt >::value > = 0>
void | enqueue () const
| Enqueue event for entity.
template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>
void | enqueue (const Evt &payload) const
| Enqueue event with payload for entity.
flecs::string | to_json (const flecs::entity_to_json_desc_t *desc=nullptr) const
| Serialize entity to JSON.
const Self & | unit (const char *symbol, flecs::entity_t prefix=0, flecs::entity_t base=0, flecs::entity_t over=0, int32_t factor=0, int32_t power=0) const
| Make entity a unit.
Public Member Functions inherited from flecs::id
| id (flecs::id_t value)
| id (flecs::world_t *world, flecs::id_t value=0)
| id (flecs::world_t *world, flecs::id_t first, flecs::id_t second)
| id (flecs::world_t *world, const char *expr)
| id (flecs::id_t first, flecs::id_t second)
| id (const flecs::id &first, const flecs::id &second)
bool | is_pair () const
| Test if id is pair (has first, second)
bool | is_wildcard () const
| Test if id is a wildcard.
bool | is_entity () const
| Test if id is entity.
flecs::entity | entity () const
| Return id as entity (only allowed when id is valid entity)
flecs::entity | add_flags (flecs::id_t flags) const
| Return id with role added.
flecs::entity | remove_flags (flecs::id_t flags) const
| Return id with role removed.
flecs::entity | remove_flags () const
| Return id without role.
flecs::entity | remove_generation () const
| Return id without role.
flecs::entity | type_id () const
| Return component type of id.
bool | has_flags (flecs::id_t flags) const
| Test if id has specified role.
bool | has_flags () const
| Test if id has any role.
flecs::entity | flags () const
| Return id flags set on id.
bool | has_relation (flecs::id_t first) const
| Test if id has specified first.
flecs::entity | first () const
| Get first element from a pair.
flecs::entity | second () const
| Get second element from a pair.
flecs::string | str () const
flecs::string | flags_str () const
| Convert role of id to string.
flecs::id_t | raw_id () const
| Return flecs::id_t value.
| operator flecs::id_t () const
flecs::world | world () const

## Protected Member Functions
const Self & | to_base () const
const Self & | unit (const char *symbol, flecs::entity_t prefix=0, flecs::entity_t base=0, flecs::entity_t over=0, int32_t factor=0, int32_t power=0) const
| Make entity a unit.
const Self & | unit (flecs::entity_t prefix=0, flecs::entity_t base=0, flecs::entity_t over=0, int32_t factor=0, int32_t power=0) const
| Make entity a derived unit.
const Self & | unit_prefix (const char *symbol, int32_t factor=0, int32_t power=0) const
| Make entity a derived unit.
const Self & | quantity (flecs::entity_t quantity) const
| Add quantity to unit.
template<typename Quantity>
const Self & | quantity () const
| Make entity a unity prefix.
const Self & | quantity () const
| Make entity a quantity.

## Additional Inherited Members
Protected Attributes inherited from flecs::id
flecs::world_t * | world_
flecs::id_t | id_
const Self & | unit (flecs::entity_t prefix=0, flecs::entity_t base=0, flecs::entity_t over=0, int32_t factor=0, int32_t power=0) const
| Make entity a derived unit.
const Self & | unit_prefix (const char *symbol, int32_t factor=0, int32_t power=0) const
| Make entity a derived unit.
const Self & | quantity (flecs::entity_t quantity) const
| Add quantity to unit.
template<typename Quantity>
const Self & | quantity () const
| Make entity a unity prefix.
const Self & | quantity () const
| Make entity a quantity.

## Detailed Description

template<typename Self>
struct flecs::entity_builder< Self >

Entity builder.

Definition at line 15 of file builder.hpp.

## Member Function Documentation

## ◆ add() [1/7]

template<typename Self>
template<typename T>

const Self & flecs::entity_builder< Self >::add | ( |  | ) | const
| inline

Add a component to an entity.

To ensure the component is initialized, it should have a constructor.

Template Parameters

  T | the component type to add.

Definition at line 25 of file builder.hpp.

## ◆ add() [2/7]

template<typename Self>
template<typename First, typename Second>

const Self & flecs::entity_builder< Self >::add | ( |  | ) | const
| inline

Add a pair.

This operation adds a pair to the entity.

Template Parameters

  First | The first element of the pair
  Second | The second element of the pair

Definition at line 79 of file builder.hpp.

## ◆ add() [3/7]

template<typename Self>
template<typename E, if_t< is_enum< E >::value > = 0>

const Self & flecs::entity_builder< Self >::add | ( | E | value | ) | const
| inline

Add pair for enum constant.

This operation will add a pair to the entity where the first element is the enumeration type, and the second element the enumeration constant.

The operation may be used with regular (C style) enumerations as well as enum classes.

Parameters

  value | The enumeration value.

Definition at line 42 of file builder.hpp.

## ◆ add() [4/7]

template<typename Self>

const Self & flecs::entity_builder< Self >::add | ( | entity_t | first,
|  | entity_t | second ) const
| inline

Add a pair.

This operation adds a pair to the entity.

Parameters

  first | The first element of the pair.
  second | The second element of the pair.

Definition at line 67 of file builder.hpp.

## ◆ add() [5/7]

template<typename Self>

const Self & flecs::entity_builder< Self >::add | ( | id_t | component | ) | const
| inline

Add an entity to an entity.

Add an entity to the entity. This is typically used for tagging.

Parameters

  component | The component to add.

Definition at line 56 of file builder.hpp.

## ◆ add() [6/7]

template<typename Self>
template<typename First, typename Second, if_t< is_enum< Second >::value &&!std::is_same< First, Second >::value > = 0>

const Self & flecs::entity_builder< Self >::add | ( | Second | constant | ) | const
| inline

Add a pair.

This operation adds a pair to the entity that consists out of a tag combined with an enum constant.

Template Parameters

  First | The first element of the pair

Parameters

  constant | the enum constant.

Definition at line 104 of file builder.hpp.

## ◆ add() [7/7]

template<typename Self>
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>

const Self & flecs::entity_builder< Self >::add | ( | Second | second | ) | const
| inline

Add a pair.

This operation adds a pair to the entity.

Template Parameters

  First | The first element of the pair

Parameters

  second | The second element of the pair.

Definition at line 90 of file builder.hpp.

## ◆ add_if() [1/6]

template<typename Self>
template<typename T>

const Self & flecs::entity_builder< Self >::add_if | ( | bool | cond | ) | const
| inline

Conditional add.

This operation adds if condition is true, removes if condition is false.

Template Parameters

  T | The component to add.

Parameters

  cond | The condition to evaluate.

Definition at line 143 of file builder.hpp.

## ◆ add_if() [2/6]

template<typename Self>
template<typename First, typename Second>

const Self & flecs::entity_builder< Self >::add_if | ( | bool | cond | ) | const
| inline

Conditional add.

This operation adds if condition is true, removes if condition is false.

Template Parameters

  First | The first element of the pair
  Second | The second element of the pair

Parameters

  cond | The condition to evaluate.

Definition at line 193 of file builder.hpp.

## ◆ add_if() [3/6]

template<typename Self>
template<typename E, if_t< is_enum< E >::value > = 0>

const Self & flecs::entity_builder< Self >::add_if | ( | bool | cond,
|  | E | constant ) const
| inline

Conditional add.

This operation adds if condition is true, removes if condition is false.

Parameters

  cond | The condition to evaluate.
  constant | The enumeration constant.

Definition at line 204 of file builder.hpp.

## ◆ add_if() [4/6]

template<typename Self>

const Self & flecs::entity_builder< Self >::add_if | ( | bool | cond,
|  | flecs::entity_t | first,
|  | flecs::entity_t | second ) const
| inline

Conditional add.

This operation adds if condition is true, removes if condition is false.

Parameters

  cond | The condition to evaluate.
  first | The first element of the pair.
  second | The second element of the pair.

Definition at line 158 of file builder.hpp.

## ◆ add_if() [5/6]

template<typename Self>
template<typename First>

const Self & flecs::entity_builder< Self >::add_if | ( | bool | cond,
|  | flecs::entity_t | second ) const
| inline

Conditional add.

This operation adds if condition is true, removes if condition is false.

Template Parameters

  First | The first element of the pair

Parameters

  cond | The condition to evaluate.
  second | The second element of the pair.

Definition at line 181 of file builder.hpp.

## ◆ add_if() [6/6]

template<typename Self>

const Self & flecs::entity_builder< Self >::add_if | ( | bool | cond,
|  | flecs::id_t | component ) const
| inline

Conditional add.

This operation adds if condition is true, removes if condition is false.

Parameters

  cond | The condition to evaluate.
  component | The component to add.

Definition at line 128 of file builder.hpp.

## ◆ add_second()

template<typename Self>
template<typename Second>

const Self & flecs::entity_builder< Self >::add_second | ( | flecs::entity_t | first | ) | const
| inline

Add a pair.

This operation adds a pair to the entity.

Parameters

  first | The first element of the pair

Template Parameters

  Second | The second element of the pair

Definition at line 118 of file builder.hpp.

## ◆ assign() [1/9]

template<typename Self>
template<typename T, typename A = actual_type_t<T>, if_not_t< is_actual< T >::value > = 0>

const Self & flecs::entity_builder< Self >::assign | ( | A && | value | ) | const
| inline

Assign a component for an entity.

This operation sets the component value. If the entity did not yet have the component the operation will panic.

Template Parameters

  T | The component.

Parameters

  value | The value to set.

Definition at line 907 of file builder.hpp.

## ◆ assign() [2/9]

template<typename Self>
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>

const Self & flecs::entity_builder< Self >::assign | ( | A && | value | ) | const
| inline

Assign a pair for an entity.

This operation sets the pair value, and uses First as type. If the entity did not yet have the component the operation will panic.

Template Parameters

  First | The first element of the pair.
  Second | The second element of the pair

Parameters

  value | The value to set.

Definition at line 936 of file builder.hpp.

## ◆ assign() [3/9]

template<typename Self>
template<typename T, typename A = actual_type_t<T>, if_not_t< is_actual< T >::value > = 0>

const Self & flecs::entity_builder< Self >::assign | ( | const A & | value | ) | const
| inline

Assign a component for an entity.

This operation sets the component value. If the entity did not yet have the component the operation will panic.

Template Parameters

  T | The component.

Parameters

  value | The value to set.

Definition at line 921 of file builder.hpp.

## ◆ assign() [4/9]

template<typename Self>
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>

const Self & flecs::entity_builder< Self >::assign | ( | const A & | value | ) | const
| inline

Assign a pair for an entity.

This operation sets the pair value, and uses First as type. If the entity did not yet have the component the operation will panic.

Template Parameters

  First | The first element of the pair.
  Second | The second element of the pair

Parameters

  value | The value to set.

Definition at line 951 of file builder.hpp.

## ◆ assign() [5/9]

template<typename Self>
template<typename T, if_t< is_actual< T >::value > = 0>

const Self & flecs::entity_builder< Self >::assign | ( | const T & | value | ) | const
| inline

Assign a component for an entity.

This operation sets the component value. If the entity did not yet have the component the operation will panic.

Template Parameters

  T | The component.

Parameters

  value | The value to set.

Definition at line 893 of file builder.hpp.

## ◆ assign() [6/9]

template<typename Self>
template<typename First, typename Second, if_t< is_enum< Second >::value > = 0>

const Self & flecs::entity_builder< Self >::assign | ( | Second | constant,
|  | const First & | value ) const
| inline

Assign a pair for an entity.

This operation sets the pair value, and uses First as type. If the entity did not yet have the component the operation will panic.

Template Parameters

  First | The first element of the pair.

Parameters

  constant | The enum constant.
  value | The value to set.

Definition at line 997 of file builder.hpp.

## ◆ assign() [7/9]

template<typename Self>
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>

const Self & flecs::entity_builder< Self >::assign | ( | Second | second,
|  | const First & | value ) const
| inline

Assign a pair for an entity.

This operation sets the pair value, and uses First as type. If the entity did not yet have the component the operation will panic.

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.
  value | The value to set.

Definition at line 965 of file builder.hpp.

## ◆ assign() [8/9]

template<typename Self>
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>

const Self & flecs::entity_builder< Self >::assign | ( | Second | second,
|  | First && | value ) const
| inline

Assign a pair for an entity.

This operation sets the pair value, and uses First as type. If the entity did not yet have the component the operation will panic.

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.
  value | The value to set.

Definition at line 981 of file builder.hpp.

## ◆ assign() [9/9]

template<typename Self>
template<typename T, if_t< is_actual< T >::value > = 0>

const Self & flecs::entity_builder< Self >::assign | ( | T && | value | ) | const
| inline

Assign a component for an entity.

This operation sets the component value. If the entity did not yet have the component the operation will panic.

Template Parameters

  T | The component.

Parameters

  value | The value to set.

Definition at line 880 of file builder.hpp.

## ◆ assign_second() [1/3]

template<typename Self>
template<typename First, typename Second>

const Self & flecs::entity_builder< Self >::assign_second | ( | const Second & | value | ) | const
| inline

Definition at line 1044 of file builder.hpp.

## ◆ assign_second() [2/3]

template<typename Self>
template<typename Second>

const Self & flecs::entity_builder< Self >::assign_second | ( | entity_t | first,
|  | const Second & | value ) const
| inline

Assign a pair for an entity.

This operation sets the pair value, and uses Second as type. If the entity did not yet have the component the operation will panic.

Template Parameters

  Second | The second element of the pair

Parameters

  first | The first element of the pair.
  value | The value to set.

Definition at line 1012 of file builder.hpp.

## ◆ assign_second() [3/3]

template<typename Self>
template<typename Second>

const Self & flecs::entity_builder< Self >::assign_second | ( | entity_t | first,
|  | Second && | value ) const
| inline

Assign a pair for an entity.

This operation sets the pair value, and uses Second as type. If the entity did not yet have the component the operation will panic.

Template Parameters

  Second | The second element of the pair

Parameters

  first | The first element of the pair.
  value | The value to set.

Definition at line 1032 of file builder.hpp.

## ◆ auto_override() [1/5]

template<typename Self>
template<typename T>

const Self & flecs::entity_builder< Self >::auto_override | ( |  | ) | const
| inline

Mark component for auto-overriding.

See also
  auto_override(flecs::id_t) const

Template Parameters

  T | The component to mark for overriding.

Definition at line 401 of file builder.hpp.

## ◆ auto_override() [2/5]

template<typename Self>
template<typename First, typename Second>

const Self & flecs::entity_builder< Self >::auto_override | ( |  | ) | const
| inline

Mark pair for auto-overriding.

See also
  auto_override(flecs::id_t) const

Template Parameters

  First | The first element of the pair.
  Second | The second element of the pair.

Definition at line 423 of file builder.hpp.

## ◆ auto_override() [3/5]

template<typename Self>

const Self & flecs::entity_builder< Self >::auto_override | ( | flecs::entity_t | first,
|  | flecs::entity_t | second ) const
| inline

Mark pair for auto-overriding.

See also
  auto_override(flecs::id_t) const

Parameters

  first | The first element of the pair.
  second | The second element of the pair.

Definition at line 391 of file builder.hpp.

## ◆ auto_override() [4/5]

template<typename Self>
template<typename First>

const Self & flecs::entity_builder< Self >::auto_override | ( | flecs::entity_t | second | ) | const
| inline

Mark pair for auto-overriding.

See also
  auto_override(flecs::id_t) const

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.

Definition at line 412 of file builder.hpp.

## ◆ auto_override() [5/5]

template<typename Self>

const Self & flecs::entity_builder< Self >::auto_override | ( | flecs::id_t | id | ) | const
| inline

Mark id for auto-overriding.

When an entity inherits from a base entity (using the IsA relationship) any ids marked for auto-overriding on the base will be overridden automatically by the entity.

Parameters

  id | The id to mark for overriding.

Definition at line 381 of file builder.hpp.

## ◆ child_of() [1/2]

template<typename Self>
template<typename T>

const Self & flecs::entity_builder< Self >::child_of | ( |  | ) | const
| inline

Shortcut for add(ChildOf, entity).

Template Parameters

  T | the type associated with the entity.

Definition at line 276 of file builder.hpp.

## ◆ child_of() [2/2]

template<typename Self>

const Self & flecs::entity_builder< Self >::child_of | ( | entity_t | second | ) | const
| inline

Shortcut for add(ChildOf, entity).

Parameters

  second | The second element of the pair.

Definition at line 230 of file builder.hpp.

## ◆ depends_on() [1/3]

template<typename Self>
template<typename T>

const Self & flecs::entity_builder< Self >::depends_on | ( |  | ) | const
| inline

Shortcut for add(DependsOn, entity).

Template Parameters

  T | the type associated with the entity.

Definition at line 285 of file builder.hpp.

## ◆ depends_on() [2/3]

template<typename Self>
template<typename E, if_t< is_enum< E >::value > = 0>

const Self & flecs::entity_builder< Self >::depends_on | ( | E | second | ) | const
| inline

Shortcut for add(DependsOn, entity).

Parameters

  second | The second element of the pair.

Definition at line 247 of file builder.hpp.

## ◆ depends_on() [3/3]

template<typename Self>

const Self & flecs::entity_builder< Self >::depends_on | ( | entity_t | second | ) | const
| inline

Shortcut for add(DependsOn, entity).

Parameters

  second | The second element of the pair.

Definition at line 238 of file builder.hpp.

## ◆ disable() [1/6]

template<typename Self>

const Self & flecs::entity_builder< Self >::disable | ( |  | ) | const
| inline

Disable an entity.

Disabled entities are not matched with systems and cannot be searched with queries, unless explicitly specified in the query expression.

Definition at line 555 of file builder.hpp.

## ◆ disable() [2/6]

template<typename Self>
template<typename T>

const Self & flecs::entity_builder< Self >::disable | ( |  | ) | const
| inline

Disable a component.

See also
  disable(flecs::id_t) const

Template Parameters

  T | The component to enable.

Definition at line 635 of file builder.hpp.

## ◆ disable() [3/6]

template<typename Self>
template<typename First, typename Second>

const Self & flecs::entity_builder< Self >::disable | ( |  | ) | const
| inline

Disable a pair.

See also
  disable(flecs::id_t) const

Template Parameters

  First | The first element of the pair.
  Second | The second element of the pair.

Definition at line 667 of file builder.hpp.

## ◆ disable() [4/6]

template<typename Self>

const Self & flecs::entity_builder< Self >::disable | ( | flecs::id_t | first,
|  | flecs::id_t | second ) const
| inline

Disable a pair.

See also
  disable(flecs::id_t) const

Parameters

  first | The first element of the pair.
  second | The second element of the pair.

Definition at line 645 of file builder.hpp.

## ◆ disable() [5/6]

template<typename Self>

const Self & flecs::entity_builder< Self >::disable | ( | flecs::id_t | id | ) | const
| inline

Disable an id.

This sets the enabled bit for this id. If this is the first time the id is enabled or disabled, the bitset is added.

Parameters

  id | The id to disable.

See also
  ecs_enable_id()
  enable(flecs::id_t) const

Definition at line 625 of file builder.hpp.

## ◆ disable() [6/6]

template<typename Self>
template<typename First>

const Self & flecs::entity_builder< Self >::disable | ( | flecs::id_t | second | ) | const
| inline

Disable a pair.

See also
  disable(flecs::id_t) const

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.

Definition at line 656 of file builder.hpp.

## ◆ emplace() [1/2]

template<typename Self>
template<typename T, typename ... Args, typename A = actual_type_t<T>>

const Self & flecs::entity_builder< Self >::emplace | ( | Args &&... | args | ) | const
| inline

Emplace component.

Emplace constructs a component in the storage, which prevents calling the destructor on the value passed into the function.

Template Parameters

  T | the component to emplace

Parameters

  args | The arguments to pass to the constructor of T

Definition at line 1076 of file builder.hpp.

## ◆ emplace() [2/2]

template<typename Self>
template<typename First, typename Second, typename ... Args, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>

const Self & flecs::entity_builder< Self >::emplace | ( | Args &&... | args | ) | const
| inline

Definition at line 1084 of file builder.hpp.

## ◆ emplace_auto_override() [1/2]

template<typename Self>
template<typename T, typename ... Args>

const Self & flecs::entity_builder< Self >::emplace_auto_override | ( | Args &&... | args | ) | const
| inline

Emplace component, mark component for auto-overriding.

See also
  auto_override(flecs::id_t) const

Template Parameters

  T | The component to emplace and override.

Parameters

  args | The arguments to pass to the constructor of T.

Definition at line 512 of file builder.hpp.

## ◆ emplace_auto_override() [2/2]

template<typename Self>
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0, typename ... Args>

const Self & flecs::entity_builder< Self >::emplace_auto_override | ( | Args &&... | args | ) | const
| inline

Emplace pair, mark pair for auto-overriding.

See also
  auto_override(flecs::id_t) const

Template Parameters

  First | The first element of the pair to emplace and override.
  Second | The second element of the pair to emplace and override.

Parameters

  args | The arguments to pass to the constructor of Second.

Definition at line 531 of file builder.hpp.

## ◆ emplace_first()

template<typename Self>
template<typename First, typename ... Args>

const Self & flecs::entity_builder< Self >::emplace_first | ( | flecs::entity_t | second,
|  | Args &&... | args ) const
| inline

Definition at line 1093 of file builder.hpp.

## ◆ emplace_second()

template<typename Self>
template<typename Second, typename ... Args>

const Self & flecs::entity_builder< Self >::emplace_second | ( | flecs::entity_t | first,
|  | Args &&... | args ) const
| inline

Definition at line 1102 of file builder.hpp.

## ◆ enable() [1/6]

template<typename Self>

const Self & flecs::entity_builder< Self >::enable | ( |  | ) | const
| inline

Enable an entity.

Enabled entities are matched with systems and can be searched with queries.

Definition at line 546 of file builder.hpp.

## ◆ enable() [2/6]

template<typename Self>
template<typename T>

const Self & flecs::entity_builder< Self >::enable | ( |  | ) | const
| inline

Enable a component.

See also
  enable(flecs::id_t) const

Template Parameters

  T | The component to enable.

Definition at line 580 of file builder.hpp.

## ◆ enable() [3/6]

template<typename Self>
template<typename First, typename Second>

const Self & flecs::entity_builder< Self >::enable | ( |  | ) | const
| inline

Enable a pair.

See also
  enable(flecs::id_t) const

Template Parameters

  First | The first element of the pair.
  Second | The second element of the pair.

Definition at line 612 of file builder.hpp.

## ◆ enable() [4/6]

template<typename Self>

const Self & flecs::entity_builder< Self >::enable | ( | flecs::id_t | first,
|  | flecs::id_t | second ) const
| inline

Enable a pair.

See also
  enable(flecs::id_t) const

Parameters

  first | The first element of the pair.
  second | The second element of the pair.

Definition at line 590 of file builder.hpp.

## ◆ enable() [5/6]

template<typename Self>

const Self & flecs::entity_builder< Self >::enable | ( | flecs::id_t | id,
|  | bool | toggle = true ) const
| inline

Enable an id.

This sets the enabled bit for this component. If this is the first time the component is enabled or disabled, the bitset is added.

Parameters

  id | The id to enable.
  toggle | True to enable, false to disable (default = true).

See also
  ecs_enable_id()

Definition at line 569 of file builder.hpp.

## ◆ enable() [6/6]

template<typename Self>
template<typename First>

const Self & flecs::entity_builder< Self >::enable | ( | flecs::id_t | second | ) | const
| inline

Enable a pair.

See also
  enable(flecs::id_t) const

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.

Definition at line 601 of file builder.hpp.

## ◆ entity_view() [1/3]

template<typename Self>

flecs::entity_view::entity_view | ( |  | ) |
| inline

Definition at line 30 of file entity_view.hpp.

## ◆ entity_view() [2/3]

template<typename Self>

flecs::entity_view::entity_view | ( | entity_t | id | ) |
| inline

Implicit conversion from flecs::entity_t to flecs::entity_view.

Definition at line 44 of file entity_view.hpp.

## ◆ entity_view() [3/3]

template<typename Self>

flecs::entity_view::entity_view | ( | flecs::world_t * | world,
|  | flecs::id_t | id )
| inlineexplicit

Wrap an existing entity id.

Parameters

  world | The world in which the entity is created.
  id | The entity id.

Definition at line 37 of file entity_view.hpp.

## ◆ insert()

template<typename Self>
template<typename Func>

const Self & flecs::entity_builder< Self >::insert | ( | const Func & | func | ) | const
| inline

Set 1..N components.

This operation accepts a callback with as arguments the components to set. If the entity does not have all of the provided components, they will be added.

This operation is faster than individually calling get for each component as it only obtains entity metadata once. When this operation is called while deferred, its performance is equivalent to that of calling ensure for each component separately.

The operation will invoke modified for each component after the callback has been invoked.

Parameters

  func | The callback to invoke.

Definition at line 23 of file impl.hpp.

## ◆ is_a() [1/2]

template<typename Self>
template<typename T>

const Self & flecs::entity_builder< Self >::is_a | ( |  | ) | const
| inline

Shortcut for add(IsA, entity).

Template Parameters

  T | the type associated with the entity.

Definition at line 222 of file builder.hpp.

## ◆ is_a() [2/2]

template<typename Self>

const Self & flecs::entity_builder< Self >::is_a | ( | entity_t | second | ) | const
| inline

Shortcut for add(IsA, entity).

Parameters

  second | The second element of the pair.

Definition at line 213 of file builder.hpp.

## ◆ observe() [1/6]

template<typename Func>

const Self & observe | ( | flecs::entity_t | evt,
|  | Func && | callback ) const

Observe event on entity.

Parameters

  evt | The event id.
  callback | The observer callback.

Returns
  Event builder.

## ◆ observe() [2/6]

template<typename Self>
template<typename Func>

const Self & flecs::entity_builder< Self >::observe | ( | flecs::entity_t | evt,
|  | Func && | callback ) const
| inline

Observe event on entity.

Parameters

  evt | The event id.
  callback | The observer callback.

Returns
  Event builder.

Definition at line 73 of file impl.hpp.

## ◆ observe() [3/6]

template<typename Evt, typename Func>

const Self & observe | ( | Func && | callback | ) | const

Observe event on entity.

Template Parameters

  Evt | The event type.

Parameters

  callback | The observer callback.

Returns
  Event builder.

## ◆ observe() [4/6]

template<typename Self>
template<typename Evt, typename Func>

const Self & flecs::entity_builder< Self >::observe | ( | Func && | callback | ) | const
| inline

Observe event on entity.

Template Parameters

  Evt | The event type.

Parameters

  callback | The observer callback.

Returns
  Event builder.

Definition at line 84 of file impl.hpp.

## ◆ observe() [5/6]

template<typename Func>

const Self & observe | ( | Func && | callback | ) | const

Observe event on entity.

Parameters

  callback | The observer callback.

Returns
  Event builder.

## ◆ observe() [6/6]

template<typename Self>
template<typename Func>

const Self & flecs::entity_builder< Self >::observe | ( | Func && | callback | ) | const
| inline

Observe event on entity.

Parameters

  callback | The observer callback.

Returns
  Event builder.

Definition at line 92 of file impl.hpp.

## ◆ remove() [1/6]

template<typename Self>
template<typename T>

const Self & flecs::entity_builder< Self >::remove | ( |  | ) | const
| inline

Remove a component from an entity.

Template Parameters

  T | the type of the component to remove.

Definition at line 303 of file builder.hpp.

## ◆ remove() [2/6]

template<typename Self>
template<typename First, typename Second>

const Self & flecs::entity_builder< Self >::remove | ( |  | ) | const
| inline

Removes a pair.

This operation removes a pair from the entity.

Template Parameters

  First | The first element of the pair
  Second | The second element of the pair

Definition at line 335 of file builder.hpp.

## ◆ remove() [3/6]

template<typename Self>

const Self & flecs::entity_builder< Self >::remove | ( | entity_t | entity | ) | const
| inline

Remove an entity from an entity.

Parameters

  entity | The entity to remove.

Definition at line 312 of file builder.hpp.

## ◆ remove() [4/6]

template<typename Self>

const Self & flecs::entity_builder< Self >::remove | ( | entity_t | first,
|  | entity_t | second ) const
| inline

Remove a pair.

This operation removes a pair from the entity.

Parameters

  first | The first element of the pair.
  second | The second element of the pair.

Definition at line 323 of file builder.hpp.

## ◆ remove() [5/6]

template<typename Self>
template<typename First, typename Second, if_t< is_enum< Second >::value > = 0>

const Self & flecs::entity_builder< Self >::remove | ( | Second | constant | ) | const
| inline

Remove a pair.

This operation removes the pair from the entity.

Template Parameters

  First | The first element of the pair

Parameters

  constant | the enum constant.

Definition at line 368 of file builder.hpp.

## ◆ remove() [6/6]

template<typename Self>
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>

const Self & flecs::entity_builder< Self >::remove | ( | Second | second | ) | const
| inline

Remove a pair.

This operation removes the pair from the entity.

Template Parameters

  First | The first element of the pair

Parameters

  second | The second element of the pair.

Definition at line 346 of file builder.hpp.

## ◆ remove_second()

template<typename Self>
template<typename Second>

const Self & flecs::entity_builder< Self >::remove_second | ( | flecs::entity_t | first | ) | const
| inline

Removes a pair.

This operation removes a pair from the entity.

Template Parameters

  Second | The second element of the pair

Parameters

  first | The first element of the pair

Definition at line 357 of file builder.hpp.

## ◆ scope() [1/2]

template<typename Self>

scoped_world flecs::entity_builder< Self >::scope | ( |  | ) | const
| inline

Return world scoped to entity.

Definition at line 1164 of file builder.hpp.

## ◆ scope() [2/2]

template<typename Self>
template<typename Func>

const Self & flecs::entity_builder< Self >::scope | ( | const Func & | func | ) | const
| inline

The function will be ran with the scope set to the current entity.

Definition at line 1156 of file builder.hpp.

## ◆ set() [1/9]

template<typename Self>
template<typename T, typename A = actual_type_t<T>, if_not_t< is_actual< T >::value > = 0>

const Self & flecs::entity_builder< Self >::set | ( | A && | value | ) | const
| inline

Set a component for an entity.

This operation sets the component value. If the entity did not yet have the component it will be added.

Template Parameters

  T | The component.

Parameters

  value | The value to set.

Definition at line 721 of file builder.hpp.

## ◆ set() [2/9]

template<typename Self>
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>

const Self & flecs::entity_builder< Self >::set | ( | A && | value | ) | const
| inline

Set a pair for an entity.

This operation sets the pair value, and uses First as type. If the entity did not yet have the pair, it will be added.

Template Parameters

  First | The first element of the pair.
  Second | The second element of the pair

Parameters

  value | The value to set.

Definition at line 750 of file builder.hpp.

## ◆ set() [3/9]

template<typename Self>
template<typename T, typename A = actual_type_t<T>, if_not_t< is_actual< T >::value > = 0>

const Self & flecs::entity_builder< Self >::set | ( | const A & | value | ) | const
| inline

Set a component for an entity.

This operation sets the component value. If the entity did not yet have the component it will be added.

Template Parameters

  T | The component.

Parameters

  value | The value to set.

Definition at line 735 of file builder.hpp.

## ◆ set() [4/9]

template<typename Self>
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>

const Self & flecs::entity_builder< Self >::set | ( | const A & | value | ) | const
| inline

Set a pair for an entity.

This operation sets the pair value, and uses First as type. If the entity did not yet have the pair, it will be added.

Template Parameters

  First | The first element of the pair.
  Second | The second element of the pair

Parameters

  value | The value to set.

Definition at line 765 of file builder.hpp.

## ◆ set() [5/9]

template<typename Self>
template<typename T, if_t< is_actual< T >::value > = 0>

const Self & flecs::entity_builder< Self >::set | ( | const T & | value | ) | const
| inline

Set a component for an entity.

This operation sets the component value. If the entity did not yet have the component it will be added.

Template Parameters

  T | The component.

Parameters

  value | The value to set.

Definition at line 707 of file builder.hpp.

## ◆ set() [6/9]

template<typename Self>
template<typename First, typename Second, if_t< is_enum< Second >::value > = 0>

const Self & flecs::entity_builder< Self >::set | ( | Second | constant,
|  | const First & | value ) const
| inline

Set a pair for an entity.

This operation sets the pair value, and uses First as type. If the entity did not yet have the pair, it will be added.

Template Parameters

  First | The first element of the pair.

Parameters

  constant | The enum constant.
  value | The value to set.

Definition at line 811 of file builder.hpp.

## ◆ set() [7/9]

template<typename Self>
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>

const Self & flecs::entity_builder< Self >::set | ( | Second | second,
|  | const First & | value ) const
| inline

Set a pair for an entity.

This operation sets the pair value, and uses First as type. If the entity did not yet have the pair, it will be added.

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.
  value | The value to set.

Definition at line 779 of file builder.hpp.

## ◆ set() [8/9]

template<typename Self>
template<typename First, typename Second, if_not_t< is_enum< Second >::value > = 0>

const Self & flecs::entity_builder< Self >::set | ( | Second | second,
|  | First && | value ) const
| inline

Set a pair for an entity.

This operation sets the pair value, and uses First as type. If the entity did not yet have the pair, it will be added.

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.
  value | The value to set.

Definition at line 795 of file builder.hpp.

## ◆ set() [9/9]

template<typename Self>
template<typename T, if_t< is_actual< T >::value > = 0>

const Self & flecs::entity_builder< Self >::set | ( | T && | value | ) | const
| inline

Set a component for an entity.

This operation sets the component value. If the entity did not yet have the component it will be added.

Template Parameters

  T | The component.

Parameters

  value | The value to set.

Definition at line 694 of file builder.hpp.

## ◆ set_alias()

template<typename Self>

const Self & flecs::entity_builder< Self >::set_alias | ( | const char * | name | ) | const
| inline

Definition at line 1177 of file builder.hpp.

## ◆ set_auto_override() [1/6]

template<typename Self>
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>

const Self & flecs::entity_builder< Self >::set_auto_override | ( | A && | val | ) | const
| inline

Set component, mark component for auto-overriding.

See also
  auto_override(flecs::id_t) const

Template Parameters

  First | The first element of the pair.
  Second | The second element of the pair.

Parameters

  val | The value to set.

Definition at line 500 of file builder.hpp.

## ◆ set_auto_override() [2/6]

template<typename Self>
template<typename First, typename Second, typename P = pair<First, Second>, typename A = actual_type_t<P>, if_not_t< flecs::is_pair< First >::value > = 0>

const Self & flecs::entity_builder< Self >::set_auto_override | ( | const A & | val | ) | const
| inline

Set component, mark component for auto-overriding.

See also
  auto_override(flecs::id_t) const

Template Parameters

  First | The first element of the pair.
  Second | The second element of the pair.

Parameters

  val | The value to set.

Definition at line 486 of file builder.hpp.

## ◆ set_auto_override() [3/6]

template<typename Self>
template<typename T>

const Self & flecs::entity_builder< Self >::set_auto_override | ( | const T & | val | ) | const
| inline

Set component, mark component for auto-overriding.

See also
  auto_override(flecs::id_t) const

Template Parameters

  T | The component to set and for which to add the OVERRIDE flag

Parameters

  val | The value to set.

Definition at line 434 of file builder.hpp.

## ◆ set_auto_override() [4/6]

template<typename Self>
template<typename First>

const Self & flecs::entity_builder< Self >::set_auto_override | ( | flecs::entity_t | second,
|  | const First & | val ) const
| inline

Set pair, mark component for auto-overriding.

See also
  auto_override(flecs::id_t) const

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.
  val | The value to set.

Definition at line 459 of file builder.hpp.

## ◆ set_auto_override() [5/6]

template<typename Self>
template<typename First>

const Self & flecs::entity_builder< Self >::set_auto_override | ( | flecs::entity_t | second,
|  | First && | val ) const
| inline

Set pair, mark component for auto-overriding.

See also
  auto_override(flecs::id_t) const

Template Parameters

  First | The first element of the pair.

Parameters

  second | The second element of the pair.
  val | The value to set.

Definition at line 472 of file builder.hpp.

## ◆ set_auto_override() [6/6]

template<typename Self>
template<typename T>

const Self & flecs::entity_builder< Self >::set_auto_override | ( | T && | val | ) | const
| inline

Set component, mark component for auto-overriding.

See also
  auto_override(flecs::id_t) const

Template Parameters

  T | The component to set and for which to add the OVERRIDE flag

Parameters

  val | The value to set.

Definition at line 446 of file builder.hpp.

## ◆ set_doc_brief()

template<typename Self>

const Self & set_doc_brief | ( | const char * | brief | ) | const

Set brief description.

This adds (flecs.doc.Description, flecs.doc.Brief) to the entity.

See also
  ecs_doc_set_brief()
  flecs::doc::set_brief()
  flecs::entity_view::doc_brief()

Definition at line 31 of file entity_builder.inl.

## ◆ set_doc_color()

template<typename Self>

const Self & set_doc_color | ( | const char * | color | ) | const

Set doc color.

This adds (flecs.doc.Description, flecs.doc.Color) to the entity.

See also
  ecs_doc_set_color()
  flecs::doc::set_color()
  flecs::entity_view::doc_color()

Definition at line 76 of file entity_builder.inl.

## ◆ set_doc_detail()

template<typename Self>

const Self & set_doc_detail | ( | const char * | detail | ) | const

Set detailed description.

This adds (flecs.doc.Description, flecs.doc.Detail) to the entity.

See also
  ecs_doc_set_detail()
  flecs::doc::set_detail()
  flecs::entity_view::doc_detail()

Definition at line 46 of file entity_builder.inl.

## ◆ set_doc_link()

template<typename Self>

const Self & set_doc_link | ( | const char * | link | ) | const

Set link to external documentation.

This adds (flecs.doc.Description, flecs.doc.Link) to the entity.

See also
  ecs_doc_set_link()
  flecs::doc::set_link()
  flecs::entity_view::doc_link()

Definition at line 61 of file entity_builder.inl.

## ◆ set_doc_name()

template<typename Self>

const Self & set_doc_name | ( | const char * | name | ) | const

Set human readable name.

This adds (flecs.doc.Description, flecs.Name) to the entity.

See also
  ecs_doc_set_name()
  flecs::doc::set_name()
  flecs::entity_view::doc_name()

Definition at line 16 of file entity_builder.inl.

## ◆ set_doc_uuid()

template<typename Self>

const Self & set_doc_uuid | ( | const char * | uuid | ) | const

Set doc UUID.

This adds (flecs.doc.Description, flecs.doc.Uuid) to the entity.

See also
  ecs_doc_set_uuid()
  flecs::doc::set_uuid()
  flecs::entity_view::doc_uuid()

Definition at line 91 of file entity_builder.inl.

## ◆ set_json() [1/5]

template<typename T>

const Self & set_json | ( | const char * | json,
|  | flecs::from_json_desc_t * | desc = nullptr ) const

Set component from JSON.

Definition at line 52 of file entity_builder.inl.

## ◆ set_json() [2/5]

template<typename R, typename T>

const Self & set_json | ( | const char * | json,
|  | flecs::from_json_desc_t * | desc = nullptr ) const

Set pair from JSON.

Definition at line 65 of file entity_builder.inl.

## ◆ set_json() [3/5]

template<typename Self>

const Self & set_json | ( | flecs::entity_t | r,
|  | flecs::entity_t | t,
|  | const char * | json,
|  | flecs::from_json_desc_t * | desc = nullptr ) const

Set pair from JSON.

Definition at line 37 of file entity_builder.inl.

## ◆ set_json() [4/5]

template<typename R>

const Self & set_json | ( | flecs::entity_t | t,
|  | const char * | json,
|  | flecs::from_json_desc_t * | desc = nullptr ) const

Set pair from JSON.

Definition at line 81 of file entity_builder.inl.

## ◆ set_json() [5/5]

template<typename Self>

const Self & set_json | ( | flecs::id_t | e,
|  | const char * | json,
|  | flecs::from_json_desc_t * | desc = nullptr ) const

Set component from JSON.

Definition at line 11 of file entity_builder.inl.

## ◆ set_json_second()

template<typename T>

const Self & set_json_second | ( | flecs::entity_t | r,
|  | const char * | json,
|  | flecs::from_json_desc_t * | desc = nullptr ) const

Set pair from JSON.

Definition at line 97 of file entity_builder.inl.

## ◆ set_name()

template<typename Self>

const Self & flecs::entity_builder< Self >::set_name | ( | const char * | name | ) | const
| inline

Definition at line 1170 of file builder.hpp.

## ◆ set_ptr() [1/2]

template<typename Self>

const Self & flecs::entity_builder< Self >::set_ptr | ( | entity_t | comp,
|  | const void * | ptr ) const
| inline

Definition at line 676 of file builder.hpp.

## ◆ set_ptr() [2/2]

template<typename Self>

const Self & flecs::entity_builder< Self >::set_ptr | ( | entity_t | comp,
|  | size_t | size,
|  | const void * | ptr ) const
| inline

Definition at line 671 of file builder.hpp.

## ◆ set_second() [1/3]

template<typename Self>
template<typename First, typename Second>

const Self & flecs::entity_builder< Self >::set_second | ( | const Second & | value | ) | const
| inline

Set a pair for an entity.

This operation sets the pair value, and uses Second as type. If the entity did not yet have the pair, it will be added.

Template Parameters

  First | The first element of the pair.
  Second | The second element of the pair

Parameters

  value | The value to set.

Definition at line 866 of file builder.hpp.

## ◆ set_second() [2/3]

template<typename Self>
template<typename Second>

const Self & flecs::entity_builder< Self >::set_second | ( | entity_t | first,
|  | const Second & | value ) const
| inline

Set a pair for an entity.

This operation sets the pair value, and uses Second as type. If the entity did not yet have the pair, it will be added.

Template Parameters

  Second | The second element of the pair

Parameters

  first | The first element of the pair.
  value | The value to set.

Definition at line 826 of file builder.hpp.

## ◆ set_second() [3/3]

template<typename Self>
template<typename Second>

const Self & flecs::entity_builder< Self >::set_second | ( | entity_t | first,
|  | Second && | value ) const
| inline

Set a pair for an entity.

This operation sets the pair value, and uses Second as type. If the entity did not yet have the pair, it will be added.

Template Parameters

  Second | The second element of the pair

Parameters

  first | The first element of the pair.
  value | The value to set.

Definition at line 846 of file builder.hpp.

## ◆ slot()

template<typename Self>

const Self & flecs::entity_builder< Self >::slot | ( |  | ) | const
| inline

Shortcut for add(SlotOf, target(ChildOf)).

Definition at line 263 of file builder.hpp.

## ◆ slot_of() [1/2]

template<typename Self>
template<typename T>

const Self & flecs::entity_builder< Self >::slot_of | ( |  | ) | const
| inline

Shortcut for add(SlotOf, entity).

Template Parameters

  T | the type associated with the entity.

Definition at line 294 of file builder.hpp.

## ◆ slot_of() [2/2]

template<typename Self>

const Self & flecs::entity_builder< Self >::slot_of | ( | entity_t | second | ) | const
| inline

Shortcut for add(SlotOf, entity).

Parameters

  second | The second element of the pair.

Definition at line 257 of file builder.hpp.

## ◆ to_base()

template<typename Self>

const Self & flecs::entity_builder< Self >::to_base | ( |  | ) | const
| inlineprotected

Definition at line 1197 of file builder.hpp.

## ◆ with() [1/3]

template<typename Self>
template<typename Func>

const Self & flecs::entity_builder< Self >::with | ( | const Func & | func | ) | const
| inline

Entities created in function will have the current entity.

This operation is thread safe.

Parameters

  func | The function to call.

Definition at line 1120 of file builder.hpp.

## ◆ with() [2/3]

template<typename Self>
template<typename First, typename Func>

const Self & flecs::entity_builder< Self >::with | ( | const Func & | func | ) | const
| inline

Entities created in function will have (First, this).

This operation is thread safe.

Template Parameters

  First | The first element of the pair

Parameters

  func | The function to call.

Definition at line 1134 of file builder.hpp.

## ◆ with() [3/3]

template<typename Self>
template<typename Func>

const Self & flecs::entity_builder< Self >::with | ( | entity_t | first,
|  | const Func & | func ) const
| inline

Entities created in function will have (first, this).

This operation is thread safe.

Parameters

  first | The first element of the pair.
  func | The function to call.

Definition at line 1146 of file builder.hpp.

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

- include/flecs/addons/cpp/mixins/entity/builder.hpp
- include/flecs/addons/cpp/mixins/doc/entity_builder.inl
- include/flecs/addons/cpp/mixins/entity/impl.hpp
- include/flecs/addons/cpp/mixins/event/entity_builder.inl
- include/flecs/addons/cpp/mixins/event/impl.hpp
- include/flecs/addons/cpp/mixins/json/entity_builder.inl