Skip to content
Flecs v4.1
flecs::entity_builder< Self > Struct Template Reference

Entity builder. More...

#include <builder.hpp>

Public Member Functions

template<typename... T, typename... Args>
const Self & add (Args... args) const
template<typename Second>
const Self & add_second (flecs::entity_t first) const
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).
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, typename... Args>
const Self & remove (Args... args) const
template<typename Second>
const Self & remove_second (flecs::entity_t first) const
template<typename... T, typename... Args>
const Self & auto_override (Args... args) const
template<typename Second>
const Self & auto_override_second (flecs::entity_t first) const
template<typename... T, typename A = _::value_type_t<T...>>
const Self & set_auto_override (A &&value) const
template<typename... T, typename A = _::value_type_t<T...>>
const Self & set_auto_override (const A &value) const
template<typename First>
const Self & set_auto_override (flecs::entity_t second, First &&value) const
template<typename First>
const Self & set_auto_override (flecs::entity_t second, const First &value) const
template<typename... T, typename... Args>
const Self & emplace_auto_override (Args &&... args) const
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, typename A = _::value_type_t<T...>>
const Self & set (A &&value) const
template<typename... T, typename A = _::value_type_t<T...>>
const Self & set (const A &value) const
template<typename First, typename Second>
const Self & set (Second second, First &&value) const
template<typename First, typename Second>
const Self & set (Second second, const First &value) const
template<typename Second>
const Self & set_second (entity_t first, Second &&value) const
template<typename Second>
const Self & set_second (entity_t first, const Second &value) const
template<typename First, typename Second>
const Self & set_second (const Second &value) const
template<typename... T, typename A = _::value_type_t<T...>>
const Self & assign (A &&value) const
template<typename... T, typename A = _::value_type_t<T...>>
const Self & assign (const A &value) const
template<typename First, typename Second>
const Self & assign (Second second, First &&value) const
template<typename First, typename Second>
const Self & assign (Second second, const First &value) const
template<typename Second>
const Self & assign_second (entity_t first, Second &&value) const
template<typename Second>
const Self & assign_second (entity_t first, const Second &value) const
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>
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 & scope (const Func &func) const
 The function will be run with the scope set to the current entity.
const Self & set_name (const char *name) const
 Set the entity name.
const Self & set_alias (const char *name) const
 Set the entity alias.
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 a 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 a pair from JSON.
template<typename T>
const Self & set_json (const char *json, flecs::from_json_desc_t *desc=nullptr) const
 Set a component from JSON.
template<typename R, typename T>
const Self & set_json (const char *json, flecs::from_json_desc_t *desc=nullptr) const
 Set a 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 a 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 a pair from JSON.
template<typename Func>
const Self & observe (flecs::entity_t evt, Func &&callback) const
 Observe an event on an entity.
template<typename Evt, typename Func>
const Self & observe (Func &&callback) const
 Observe an event on an entity.
template<typename Func>
const Self & observe (Func &&callback) const
 Observe an event on an 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 an event on an entity.
template<typename Evt, typename Func>
const Self & observe (Func &&callback) const
 Observe an event on an entity.
template<typename Func>
const Self & observe (Func &&callback) const
 Observe an event on an entity.
const Self & set_json (flecs::id_t e, const char *json, flecs::from_json_desc_t *desc=nullptr) const
 Set a 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 a pair from JSON.
template<typename T>
const Self & set_json (const char *json, flecs::from_json_desc_t *desc=nullptr) const
 Set a component from JSON.
template<typename R, typename T>
const Self & set_json (const char *json, flecs::from_json_desc_t *desc=nullptr) const
 Set a 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 a 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 a pair from JSON.
 entity_view ()
 Default constructor.
 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 ()
 Default constructor.
 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
 Conversion to bool.
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 typed parent.
bool enabled () const
 Check if entity is enabled (does not have the Disabled tag).
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 an entity.
template<typename Rel, typename Func>
void children (Func &&func) const
 Iterate children for an entity.
template<typename Func>
void children (Func &&func) const
 Iterate children for an entity.
template<typename... T, typename... Args>
decltype(auto) try_get (Args... args) const
template<typename... T, typename... Args>
decltype(auto) try_get_second (Args... args) const
template<typename... T>
auto try_get_n () const
template<typename Func, if_t< is_callable< Func >::value > = 0>
bool get (const Func &func) const
template<typename... T, typename... Args>
decltype(auto) get (Args... args) const
template<typename... T, typename... Args>
decltype(auto) get_second (Args... args) const
template<typename... T>
auto get_n () const
template<typename... T, typename... Args>
decltype(auto) try_get_mut (Args... args) const
template<typename... T, typename... Args>
decltype(auto) try_get_mut_second (Args... args) const
template<typename... T>
auto try_get_mut_n () const
template<typename... T, typename... Args>
decltype(auto) get_mut (Args... args) const
template<typename... T, typename... Args>
decltype(auto) get_mut_second (Args... args) const
template<typename... T>
auto get_mut_n () const
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
 Get the target of a pair for a given relationship ID.
template<typename First, typename Second>
flecs::entity target_for (flecs::entity_t relationship) const
 Get the target of a pair for a given relationship ID.
int32_t depth (flecs::entity_t rel) const
 Get the depth for a given relationship.
template<typename Rel>
int32_t depth () const
 Get the depth for a 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.
template<typename... T, typename... Args>
bool has (Args... args) const
template<typename Second>
bool has_second (flecs::entity_t first) const
template<typename... T, typename... Args>
bool owns (Args... args) const
template<typename Second>
bool owns_second (flecs::entity_t first) const
template<typename... T, typename... Args>
bool enabled (Args... args) const
flecs::entity clone (bool clone_value=true, flecs::entity_t dst_id=0) const
 Clone an entity.
flecs::entity mut (const flecs::world &stage) const
 Return a mutable entity handle for the current stage.
flecs::entity mut (const flecs::iter &it) const
 Same as mut(world), but for an iterator.
flecs::entity mut (const flecs::entity_view &e) const
 Same as mut(world), but for an entity.
flecs::string to_json (const flecs::entity_to_json_desc_t *desc=nullptr) const
 Serialize an 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 the number of alerts for an entity.
template<typename E>
E to_constant () const
 Convert an entity to an enum constant.
void emit (flecs::entity_t evt) const
 Emit an event for an entity.
void emit (flecs::entity evt) const
 Emit an event for an entity.
template<typename Evt, if_t< is_empty< Evt >::value > = 0>
void emit () const
 Emit an event for an entity.
template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>
void emit (const Evt &payload) const
 Emit an event with payload for an entity.
void enqueue (flecs::entity_t evt) const
 Enqueue an event for an entity.
void enqueue (flecs::entity evt) const
 Enqueue an event for an entity.
template<typename Evt, if_t< is_empty< Evt >::value > = 0>
void enqueue () const
 Enqueue an event for an entity.
template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>
void enqueue (const Evt &payload) const
 Enqueue an event with payload for an entity.
int32_t alert_count (flecs::entity_t alert=0) const
 Return the number of alerts for an 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 an entity to an enum constant.
void emit (flecs::entity_t evt) const
 Emit an event for an entity.
void emit (flecs::entity evt) const
 Emit an event for an entity.
template<typename Evt, if_t< is_empty< Evt >::value > = 0>
void emit () const
 Emit an event for an entity.
template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>
void emit (const Evt &payload) const
 Emit an event with payload for an entity.
void enqueue (flecs::entity_t evt) const
 Enqueue an event for an entity.
void enqueue (flecs::entity evt) const
 Enqueue an event for an entity.
template<typename Evt, if_t< is_empty< Evt >::value > = 0>
void enqueue () const
 Enqueue an event for an entity.
template<typename Evt, if_not_t< is_empty< Evt >::value > = 0>
void enqueue (const Evt &payload) const
 Enqueue an event with payload for an entity.
flecs::string to_json (const flecs::entity_to_json_desc_t *desc=nullptr) const
 Serialize an entity to JSON.
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 a pair (has first, second).
bool is_value_pair () const
 Test if ID is a value pair (has first, value).
bool is_wildcard () const
 Test if ID is a wildcard.
bool is_entity () const
 Test if ID is an entity.
flecs::entity entity () const
 Return ID as entity (only allowed when ID is a valid entity).
flecs::entity add_flags (flecs::id_t flags) const
 Return ID with flags added.
flecs::entity remove_flags (flecs::id_t flags) const
 Return ID with flags removed.
flecs::entity remove_flags () const
 Return ID without flags.
flecs::entity remove_generation () const
 Return ID without generation.
flecs::entity type_id () const
 Return component type of ID.
bool has_flags (flecs::id_t flags) const
 Test if ID has specified flags.
bool has_flags () const
 Test if ID has any flags.
flecs::entity flags () const
 Return ID flags set on ID.
bool has_relation (flecs::id_t first) const
 Test if ID has the specified first element.
flecs::entity first () const
 Get first element from a pair.
flecs::entity second () const
 Get second element from a pair.
flecs::string str () const
 Convert ID to string.
flecs::string flags_str () const
 Convert flags of ID to string.
flecs::id_t raw_id () const
 Return flecs::id_t value.
 operator flecs::id_t () const
flecs::world world () const
 Get the world.

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 an 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 an entity a derived unit.
const Self & unit_prefix (const char *symbol, int32_t factor=0, int32_t power=0) const
 Make an entity a unit prefix.
const Self & quantity (flecs::entity_t quantity) const
 Add a quantity to a unit.
template<typename Quantity>
const Self & quantity () const
 Add a quantity to a unit.
const Self & quantity () const
 Make an entity a quantity.
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 an 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 an entity a derived unit.
const Self & unit_prefix (const char *symbol, int32_t factor=0, int32_t power=0) const
 Make an entity a unit prefix.
const Self & quantity (flecs::entity_t quantity) const
 Add a quantity to a unit.
template<typename Quantity>
const Self & quantity () const
 Add a quantity to a unit.
const Self & quantity () const
 Make an entity a quantity.

Additional Inherited Members

Protected Attributes inherited from flecs::id
flecs::world_t * world_
 World is optional, but guarantees that entity identifiers extracted from the ID are valid.
flecs::id_t id_
 The raw ID value.

Detailed Description

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

Entity builder.

Definition at line 15 of file builder.hpp.

Member Function Documentation

◆ add()

template<typename Self>
template<typename... T, typename... Args>
const Self & flecs::entity_builder< Self >::add ( Args... args) const
inline

Definition at line 20 of file builder.hpp.

◆ add_if() [1/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
FirstThe first element of the pair.
SecondThe second element of the pair.
Parameters
condThe condition to evaluate.

Definition at line 102 of file builder.hpp.

◆ add_if() [2/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
TThe component to add.
Parameters
condThe condition to evaluate.

Definition at line 52 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
condThe condition to evaluate.
constantThe enumeration constant.

Definition at line 113 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
condThe condition to evaluate.
firstThe first element of the pair.
secondThe second element of the pair.

Definition at line 67 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
FirstThe first element of the pair.
Parameters
condThe condition to evaluate.
secondThe second element of the pair.

Definition at line 90 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
condThe condition to evaluate.
componentThe component to add.

Definition at line 37 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

Definition at line 27 of file builder.hpp.

◆ assign() [1/4]

template<typename Self>
template<typename... T, typename A = _::value_type_t<T...>>
const Self & flecs::entity_builder< Self >::assign ( A && value) const
inline

Definition at line 436 of file builder.hpp.

◆ assign() [2/4]

template<typename Self>
template<typename... T, typename A = _::value_type_t<T...>>
const Self & flecs::entity_builder< Self >::assign ( const A & value) const
inline

Definition at line 443 of file builder.hpp.

◆ assign() [3/4]

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

Definition at line 457 of file builder.hpp.

◆ assign() [4/4]

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

Definition at line 450 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 478 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

Definition at line 471 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

Definition at line 464 of file builder.hpp.

◆ auto_override()

template<typename Self>
template<typename... T, typename... Args>
const Self & flecs::entity_builder< Self >::auto_override ( Args... args) const
inline

Definition at line 193 of file builder.hpp.

◆ auto_override_second()

template<typename Self>
template<typename Second>
const Self & flecs::entity_builder< Self >::auto_override_second ( flecs::entity_t first) const
inline

Definition at line 198 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
TThe type associated with the entity.

Definition at line 167 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
secondThe second element of the pair.

Definition at line 139 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
TThe type associated with the entity.

Definition at line 176 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
secondThe second element of the pair.

Definition at line 156 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
secondThe second element of the pair.

Definition at line 147 of file builder.hpp.

◆ disable() [1/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
FirstThe first element of the pair.
SecondThe second element of the pair.

Definition at line 368 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
TThe component to disable.

Definition at line 336 of file builder.hpp.

◆ disable() [3/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 256 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
firstThe first element of the pair.
secondThe second element of the pair.

Definition at line 346 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
idThe ID to disable.
See also
ecs_enable_id()
enable(flecs::id_t) const

Definition at line 326 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
FirstThe first element of the pair.
Parameters
secondThe second element of the pair.

Definition at line 357 of file builder.hpp.

◆ emplace()

template<typename Self>
template<typename... T, typename... Args>
const Self & flecs::entity_builder< Self >::emplace ( Args &&... args) const
inline

Definition at line 502 of file builder.hpp.

◆ emplace_auto_override()

template<typename Self>
template<typename... T, typename... Args>
const Self & flecs::entity_builder< Self >::emplace_auto_override ( Args &&... args) const
inline

Definition at line 235 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 510 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 519 of file builder.hpp.

◆ enable() [1/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
FirstThe first element of the pair.
SecondThe second element of the pair.

Definition at line 313 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
TThe component to enable.

Definition at line 281 of file builder.hpp.

◆ enable() [3/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 247 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
firstThe first element of the pair.
secondThe second element of the pair.

Definition at line 291 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
idThe ID to enable.
toggleTrue to enable, false to disable (default = true).
See also
ecs_enable_id()

Definition at line 270 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
FirstThe first element of the pair.
Parameters
secondThe second element of the pair.

Definition at line 302 of file builder.hpp.

◆ entity_view() [1/3]

template<typename Self>
flecs::entity_view::entity_view ( )
inline

Default constructor.

Creates an empty entity view.

Definition at line 33 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 47 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
worldThe world in which the entity is created.
idThe entity ID.

Definition at line 40 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 ensure() 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
funcThe 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
TThe type associated with the entity.

Definition at line 131 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
secondThe second element of the pair.

Definition at line 122 of file builder.hpp.

◆ observe() [1/6]

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

Observe an event on an entity.

Parameters
evtThe event ID.
callbackThe observer callback.
Returns
Reference to self.

Definition at line 42 of file impl.hpp.

◆ observe() [2/6]

template<typename Func>
const Self & observe ( flecs::entity_t evt,
Func && callback ) const

Observe an event on an entity.

Parameters
evtThe event ID.
callbackThe observer callback.
Returns
Reference to self.

◆ observe() [3/6]

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

Observe an event on an entity.

The event type is deduced from the callback signature.

Parameters
callbackThe observer callback.
Returns
Reference to self.

Definition at line 56 of file impl.hpp.

◆ observe() [4/6]

template<typename Func>
const Self & observe ( Func && callback) const

Observe an event on an entity.

The event type is deduced from the callback signature.

Parameters
callbackThe observer callback.
Returns
Reference to self.

◆ observe() [5/6]

template<typename Self>
template<typename Evt, typename Func>
const Self & flecs::entity_builder< Self >::observe ( Func && callback) const
inline

Observe an event on an entity.

Template Parameters
EvtThe event type.
Parameters
callbackThe observer callback.
Returns
Reference to self.

Definition at line 49 of file impl.hpp.

◆ observe() [6/6]

template<typename Evt, typename Func>
const Self & observe ( Func && callback) const

Observe an event on an entity.

Template Parameters
EvtThe event type.
Parameters
callbackThe observer callback.
Returns
Reference to self.

◆ remove()

template<typename Self>
template<typename... T, typename... Args>
const Self & flecs::entity_builder< Self >::remove ( Args... args) const
inline

Definition at line 181 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

Definition at line 188 of file builder.hpp.

◆ scope()

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

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

Definition at line 533 of file builder.hpp.

◆ set() [1/4]

template<typename Self>
template<typename... T, typename A = _::value_type_t<T...>>
const Self & flecs::entity_builder< Self >::set ( A && value) const
inline

Definition at line 388 of file builder.hpp.

◆ set() [2/4]

template<typename Self>
template<typename... T, typename A = _::value_type_t<T...>>
const Self & flecs::entity_builder< Self >::set ( const A & value) const
inline

Definition at line 395 of file builder.hpp.

◆ set() [3/4]

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

Definition at line 409 of file builder.hpp.

◆ set() [4/4]

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

Definition at line 402 of file builder.hpp.

◆ set_alias()

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

Set the entity alias.

Definition at line 547 of file builder.hpp.

◆ set_auto_override() [1/4]

template<typename Self>
template<typename... T, typename A = _::value_type_t<T...>>
const Self & flecs::entity_builder< Self >::set_auto_override ( A && value) const
inline

Definition at line 203 of file builder.hpp.

◆ set_auto_override() [2/4]

template<typename Self>
template<typename... T, typename A = _::value_type_t<T...>>
const Self & flecs::entity_builder< Self >::set_auto_override ( const A & value) const
inline

Definition at line 211 of file builder.hpp.

◆ set_auto_override() [3/4]

template<typename Self>
template<typename First>
const Self & flecs::entity_builder< Self >::set_auto_override ( flecs::entity_t second,
const First & value ) const
inline

Definition at line 227 of file builder.hpp.

◆ set_auto_override() [4/4]

template<typename Self>
template<typename First>
const Self & flecs::entity_builder< Self >::set_auto_override ( flecs::entity_t second,
First && value ) const
inline

Definition at line 219 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 R, typename T>
const Self & set_json ( const char * json,
flecs::from_json_desc_t * desc = nullptr ) const

Set a pair from JSON.

Definition at line 65 of file entity_builder.inl.

◆ set_json() [2/5]

template<typename T>
const Self & set_json ( const char * json,
flecs::from_json_desc_t * desc = nullptr ) const

Set a component from JSON.

Definition at line 52 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 a 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 a 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 a 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 a 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

Set the entity name.

Definition at line 541 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 377 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 372 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

Definition at line 430 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

Definition at line 423 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

Definition at line 416 of file builder.hpp.

◆ to_base()

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

Definition at line 567 of file builder.hpp.

◆ unit()

template<typename Self>
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 an entity a unit.

Definition at line 14 of file entity_builder.inl.

◆ quantity() [1/3]

template<typename Self>
const Self & quantity ( ) const
related

Make an entity a quantity.

Definition at line 84 of file entity_builder.inl.

◆ quantity() [2/3]

template<typename Quantity>
const Self & quantity ( ) const
related

Add a quantity to a unit.

Definition at line 79 of file entity_builder.inl.

◆ quantity() [3/3]

template<typename Self>
const Self & quantity ( flecs::entity_t quantity) const
related

Add a quantity to a unit.

Definition at line 72 of file entity_builder.inl.

◆ unit()

template<typename Self>
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
related

Make an entity a derived unit.

Definition at line 36 of file entity_builder.inl.

◆ unit_prefix()

template<typename Self>
const Self & unit_prefix ( const char * symbol,
int32_t factor = 0,
int32_t power = 0 ) const
related

Make an entity a unit prefix.

Definition at line 56 of file entity_builder.inl.


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