Flecs v3.1
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
flecs::entity_builder< Self > Struct Template Reference

Entity builder. More...

#include <builder.hpp>

Inheritance diagram for flecs::entity_builder< Self >:
flecs::entity_view flecs::id

Public Member Functions

template<typename T >
Self & add ()
 Add a component to an entity. More...
 
Self & add (id_t component)
 Add an entity to an entity. More...
 
Self & add (entity_t first, entity_t second)
 Add a pair. More...
 
template<typename First , typename Second >
Self & add ()
 Add a pair. More...
 
template<typename First , typename Second , if_not_t< is_enum< Second >::value > = 0>
Self & add (Second second)
 Add a pair. More...
 
template<typename First , typename Second , if_t< is_enum< Second >::value > = 0>
Self & add (Second constant)
 Add a pair. More...
 
template<typename Second >
Self & add_second (flecs::entity_t first)
 Add a pair. More...
 
Self & add_if (bool cond, flecs::id_t component)
 Conditional add. More...
 
template<typename T >
Self & add_if (bool cond)
 Conditional add. More...
 
Self & add_if (bool cond, flecs::entity_t first, flecs::entity_t second)
 Conditional add. More...
 
template<typename First >
Self & add_if (bool cond, flecs::entity_t second)
 Conditional add. More...
 
template<typename First , typename Second >
Self & add_if (bool cond)
 Conditional add. More...
 
template<typename E , if_t< is_enum< E >::value > = 0>
Self & add_if (bool cond, E constant)
 Conditional add. More...
 
Self & is_a (entity_t second)
 Shortcut for add(IsA, entity). More...
 
template<typename T >
Self & is_a ()
 Shortcut for add(IsA, entity). More...
 
Self & child_of (entity_t second)
 Shortcut for add(ChildOf, entity). More...
 
Self & depends_on (entity_t second)
 Shortcut for add(DependsOn, entity). More...
 
Self & slot_of (entity_t second)
 Shortcut for add(SlotOf, entity). More...
 
Self & slot ()
 Shortcut for add(SlotOf, target(ChildOf)). More...
 
template<typename T >
Self & child_of ()
 Shortcut for add(ChildOf, entity). More...
 
template<typename T >
Self & depends_on ()
 Shortcut for add(DependsOn, entity). More...
 
template<typename T >
Self & slot_of ()
 Shortcut for add(SlotOf, entity). More...
 
template<typename T , if_not_t< is_enum< T >::value > = 0>
Self & remove ()
 Remove a component from an entity. More...
 
Self & remove (entity_t entity)
 Remove an entity from an entity. More...
 
Self & remove (entity_t first, entity_t second)
 Remove a pair. More...
 
template<typename First , typename Second >
Self & remove ()
 Removes a pair. More...
 
template<typename First , typename Second , if_not_t< is_enum< Second >::value > = 0>
Self & remove (Second second)
 Remove a pair. More...
 
template<typename Second >
Self & remove_second (flecs::entity_t first)
 Removes a pair. More...
 
template<typename First , typename Second , if_t< is_enum< Second >::value > = 0>
Self & remove (Second constant)
 Remove a pair. More...
 
Self & override (flecs::id_t id)
 Mark id for auto-overriding. More...
 
Self & override (flecs::entity_t first, flecs::entity_t second)
 Mark pair for auto-overriding. More...
 
template<typename T >
Self & override ()
 Mark component for auto-overriding. More...
 
template<typename First >
Self & override (flecs::entity_t second)
 Mark pair for auto-overriding. More...
 
template<typename First , typename Second >
Self & override ()
 Mark pair for auto-overriding. More...
 
template<typename T >
Self & set_override (const T &val)
 Set component, mark component for auto-overriding. More...
 
template<typename T >
Self & set_override (T &&val)
 Set component, mark component for auto-overriding. More...
 
template<typename First >
Self & set_override (flecs::entity_t second, const First &val)
 Set pair, mark component for auto-overriding. More...
 
template<typename First >
Self & set_override (flecs::entity_t second, First &&val)
 Set pair, mark component for auto-overriding. More...
 
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>
Self & set_override (const A &val)
 Set component, mark component for auto-overriding. More...
 
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>
Self & set_override (A &&val)
 Set component, mark component for auto-overriding. More...
 
template<typename T , typename ... Args>
Self & emplace_override (Args &&... args)
 Emplace component, mark component for auto-overriding. More...
 
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>
Self & emplace_override (Args &&... args)
 Emplace pair, mark pair for auto-overriding. More...
 
template<typename E , if_t< is_enum< E >::value > = 0>
Self & add (E value)
 Add pair for enum constant. More...
 
template<typename E , if_t< is_enum< E >::value > = 0>
Self & remove ()
 Remove pair for enum. More...
 
Self & enable ()
 Enable an entity. More...
 
Self & disable ()
 Disable an entity. More...
 
Self & enable (flecs::id_t id, bool toggle=true)
 Enable an id. More...
 
template<typename T >
Self & enable ()
 Enable a component. More...
 
Self & enable (flecs::id_t first, flecs::id_t second)
 Enable a pair. More...
 
template<typename First >
Self & enable (flecs::id_t second)
 Enable a pair. More...
 
template<typename First , typename Second >
Self & enable ()
 Enable a pair. More...
 
Self & disable (flecs::id_t id)
 Disable an id. More...
 
template<typename T >
Self & disable ()
 Disable a component. More...
 
Self & disable (flecs::id_t first, flecs::id_t second)
 Disable a pair. More...
 
template<typename First >
Self & disable (flecs::id_t second)
 Disable a pair. More...
 
template<typename First , typename Second >
Self & disable ()
 Disable a pair. More...
 
Self & set_ptr (entity_t comp, size_t size, const void *ptr)
 
Self & set_ptr (entity_t comp, const void *ptr)
 
template<typename T , if_t< !is_callable< T >::value &&is_actual< T >::value > = 0>
Self & set (T &&value)
 
template<typename T , if_t< !is_callable< T >::value &&is_actual< T >::value > = 0>
Self & set (const T &value)
 
template<typename T , typename A = actual_type_t<T>, if_not_t< is_callable< T >::value||is_actual< T >::value > = 0>
Self & set (A &&value)
 
template<typename T , typename A = actual_type_t<T>, if_not_t< is_callable< T >::value||is_actual< T >::value > = 0>
Self & set (const A &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>
Self & set (A &&value)
 Set a pair for an entity. More...
 
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>
Self & set (const A &value)
 Set a pair for an entity. More...
 
template<typename First , typename Second , if_not_t< is_enum< Second >::value > = 0>
Self & set (Second second, const First &value)
 Set a pair for an entity. More...
 
template<typename First , typename Second , if_not_t< is_enum< Second >::value > = 0>
Self & set (Second second, First &&value)
 Set a pair for an entity. More...
 
template<typename First , typename Second , if_t< is_enum< Second >::value > = 0>
Self & set (Second constant, const First &value)
 Set a pair for an entity. More...
 
template<typename Second >
Self & set_second (entity_t first, const Second &value)
 Set a pair for an entity. More...
 
template<typename Second >
Self & set_second (entity_t first, Second &&value)
 Set a pair for an entity. More...
 
template<typename First , typename Second >
Self & set_second (const Second &value)
 
template<typename Func , if_t< is_callable< Func >::value > = 0>
Self & set (const Func &func)
 Set 1..N components. More...
 
template<typename T , typename ... Args, typename A = actual_type_t<T>>
Self & emplace (Args &&... args)
 Emplace component. More...
 
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>
Self & emplace (Args &&... args)
 
template<typename First , typename ... Args>
Self & emplace_first (flecs::entity_t second, Args &&... args)
 
template<typename Second , typename ... Args>
Self & emplace_second (flecs::entity_t first, Args &&... args)
 
template<typename Func >
Self & with (const Func &func)
 Entities created in function will have the current entity. More...
 
template<typename First , typename Func >
Self & with (const Func &func)
 Entities created in function will have (First, this). More...
 
template<typename Func >
Self & with (entity_t first, const Func &func)
 Entities created in function will have (first, this). More...
 
template<typename Func >
Self & scope (const Func &func)
 The function will be ran with the scope set to the current entity. More...
 
Self & set_name (const char *name)
 
Self & set_doc_name (const char *name)
 Set doc name. More...
 
Self & set_doc_brief (const char *brief)
 Set doc brief. More...
 
Self & set_doc_detail (const char *detail)
 Set doc detailed description. More...
 
Self & set_doc_link (const char *link)
 Set doc link. More...
 
Self & set_doc_color (const char *link)
 Set doc color. More...
 
 entity_view ()
 
 entity_view (flecs::world_t *world, flecs::id_t id)
 Wrap an existing entity id. More...
 
 entity_view (entity_t id)
 Implicit conversion from flecs::entity_t to flecs::entity_view. More...
 
- Public Member Functions inherited from flecs::entity_view
 entity_view (flecs::world_t *world, flecs::id_t id)
 Wrap an existing entity id. More...
 
 entity_view (entity_t id)
 Implicit conversion from flecs::entity_t to flecs::entity_view. More...
 
entity_t id () const
 Get entity id. More...
 
bool is_valid () const
 Check is entity is valid. More...
 
 operator bool () const
 
bool is_alive () const
 Check is entity is alive. More...
 
flecs::string_view name () const
 Return the entity name. More...
 
flecs::string_view symbol () const
 Return the entity symbol. More...
 
flecs::string path (const char *sep="::", const char *init_sep="::") const
 Return the entity path. More...
 
bool enabled () const
 
flecs::type type () const
 Get the entity's type. More...
 
flecs::table table () const
 Get the entity's table. More...
 
flecs::table_range range () const
 Get table range for the entity. More...
 
template<typename Func >
void each (const Func &func) const
 Iterate (component) ids of an entity. More...
 
template<typename Func >
void each (flecs::id_t first, flecs::id_t second, const Func &func) const
 Iterate matching pair ids of an entity. More...
 
template<typename Func >
void each (const flecs::entity_view &rel, const Func &func) const
 Iterate targets for a given relationship. More...
 
template<typename First , typename Func >
void each (const Func &func) const
 Iterate targets for a given relationship. More...
 
template<typename Func >
void children (flecs::entity_t rel, Func &&func) const
 Iterate children for entity. More...
 
template<typename Rel , typename Func >
void children (Func &&func) const
 Iterate children for entity. More...
 
template<typename Func >
void children (Func &&func) const
 Iterate children for entity. More...
 
template<typename T , if_t< is_actual< T >::value > = 0>
const T * get () const
 Get component value. More...
 
template<typename T , typename A = actual_type_t<T>, if_t< flecs::is_pair< T >::value > = 0>
const A * get () const
 Get component value. More...
 
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. More...
 
template<typename First , typename Second , if_not_t< is_enum< Second >::value > = 0>
const First * get (Second second) const
 Get a pair. More...
 
template<typename First , typename Second , if_t< is_enum< Second >::value > = 0>
const First * get (Second constant) const
 Get a pair. More...
 
const void * get (flecs::id_t comp) const
 Get component value (untyped). More...
 
const void * get (flecs::entity_t first, flecs::entity_t second) const
 Get a pair (untyped). More...
 
template<typename Func , if_t< is_callable< Func >::value > = 0>
bool get (const Func &func) const
 Get 1..N components. More...
 
template<typename T , if_t< is_enum< T >::value > = 0>
const T * get () const
 Get enum constant. More...
 
template<typename Second >
const Second * get_second (flecs::entity_t first) const
 Get the second part for a pair. More...
 
template<typename First , typename Second >
const Second * get_second () const
 Get the second part for a pair. More...
 
template<typename First >
flecs::entity target (int32_t index=0) const
 Get target for a given pair. More...
 
flecs::entity target (flecs::entity_t first, int32_t index=0) const
 Get target for a given pair. More...
 
flecs::entity target_for (flecs::entity_t relationship, flecs::id_t id) const
 Get the target of a pair for a given relationship id. More...
 
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. More...
 
template<typename Rel >
int32_t depth () const
 Get depth for given relationship. More...
 
flecs::entity parent () const
 Get parent of entity. More...
 
flecs::entity lookup (const char *path) const
 Lookup an entity by name. More...
 
bool has (flecs::id_t e) const
 Check if entity has the provided entity. More...
 
template<typename T >
bool has () const
 Check if entity has the provided component. More...
 
template<typename E , if_t< is_enum< E >::value > = 0>
bool has (E value) const
 Check if entity has the provided enum constant. More...
 
template<typename First , typename Second >
bool has () const
 Check if entity has the provided pair. More...
 
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. More...
 
template<typename Second >
bool has_second (flecs::entity_t first) const
 Check if entity has the provided pair. More...
 
template<typename First , typename E , if_t< is_enum< E >::value > = 0>
bool has (E value) const
 Check if entity has the provided pair. More...
 
bool has (flecs::id_t first, flecs::id_t second) const
 Check if entity has the provided pair. More...
 
bool owns (flecs::id_t e) const
 Check if entity owns the provided entity. More...
 
template<typename First >
bool owns (flecs::id_t second) const
 Check if entity owns the provided pair. More...
 
bool owns (flecs::id_t first, flecs::id_t second) const
 Check if entity owns the provided pair. More...
 
template<typename T >
bool owns () const
 Check if entity owns the provided component. More...
 
template<typename First , typename Second >
bool owns () const
 Check if entity owns the provided pair. More...
 
bool enabled (flecs::id_t id) const
 Test if id is enabled. More...
 
template<typename T >
bool enabled () const
 Test if component is enabled. More...
 
bool enabled (flecs::id_t first, flecs::id_t second) const
 Test if pair is enabled. More...
 
template<typename First >
bool enabled (flecs::id_t second) const
 Test if pair is enabled. More...
 
template<typename First , typename Second >
bool enabled () const
 Test if pair is enabled. More...
 
ecs_ftime_t delta_time () const
 Get current delta time. More...
 
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. More...
 
flecs::entity mut (const flecs::iter &it) const
 Same as mut(world), but for iterator. More...
 
flecs::entity mut (const flecs::entity_view &e) const
 Same as mut(world), but for entity. More...
 
template<typename E >
to_constant () const
 Convert entity to enum constant. More...
 
flecs::string to_json (const flecs::entity_to_json_desc_t *desc=nullptr)
 Serialize entity to JSON. More...
 
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)
 Make entity a unit. More...
 
- 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::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) More...
 
bool is_wildcard () const
 Test if id is a wildcard. More...
 
bool is_entity () const
 Test if id is entity. More...
 
flecs::entity entity () const
 Return id as entity (only allowed when id is valid entity) More...
 
flecs::entity add_flags (flecs::id_t flags) const
 Return id with role added. More...
 
flecs::entity remove_flags (flecs::id_t flags) const
 Return id with role removed. More...
 
flecs::entity remove_flags () const
 Return id without role. More...
 
flecs::entity remove_generation () const
 Return id without role. More...
 
flecs::entity type_id () const
 Return component type of id. More...
 
bool has_flags (flecs::id_t flags) const
 Test if id has specified role. More...
 
bool has_flags () const
 Test if id has any role. More...
 
flecs::entity flags () const
 Return id flags set on id. More...
 
bool has_relation (flecs::id_t first) const
 Test if id has specified first. More...
 
flecs::entity first () const
 Get first element from a pair. More...
 
flecs::entity second () const
 Get second element from a pair. More...
 
flecs::string str () const
 
flecs::string flags_str () const
 Convert role of id to string. More...
 
flecs::id_t raw_id () const
 Return flecs::id_t value. More...
 
 operator flecs::id_t () const
 
flecs::world world () const
 

Protected Member Functions

Self & to_base ()
 

Additional Inherited Members

- Protected Attributes inherited from flecs::id
flecs::world_t * m_world
 
flecs::id_t m_id
 

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 >
Self & flecs::entity_builder< Self >::add ( )
inline

Add a component to an entity.

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

Template Parameters
Tthe component type to add.

Definition at line 25 of file builder.hpp.

◆ add() [2/7]

template<typename Self >
template<typename First , typename Second >
Self & flecs::entity_builder< Self >::add ( )
inline

Add a pair.

This operation adds a pair to the entity.

Template Parameters
FirstThe first element of the pair
SecondThe second element of the pair

Definition at line 60 of file builder.hpp.

◆ add() [3/7]

template<typename Self >
template<typename E , if_t< is_enum< E >::value > = 0>
Self & flecs::entity_builder< Self >::add ( value)
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
valueThe enumeration value.

Definition at line 514 of file builder.hpp.

◆ add() [4/7]

template<typename Self >
Self & flecs::entity_builder< Self >::add ( entity_t  first,
entity_t  second 
)
inline

Add a pair.

This operation adds a pair to the entity.

Parameters
firstThe first element of the pair.
secondThe second element of the pair.

Definition at line 48 of file builder.hpp.

◆ add() [5/7]

template<typename Self >
Self & flecs::entity_builder< Self >::add ( id_t  component)
inline

Add an entity to an entity.

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

Parameters
componentThe component to add.

Definition at line 37 of file builder.hpp.

◆ add() [6/7]

template<typename Self >
template<typename First , typename Second , if_t< is_enum< Second >::value > = 0>
Self & flecs::entity_builder< Self >::add ( Second  constant)
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
FirstThe first element of the pair
Parameters
constantthe enum constant.

Definition at line 85 of file builder.hpp.

◆ add() [7/7]

template<typename Self >
template<typename First , typename Second , if_not_t< is_enum< Second >::value > = 0>
Self & flecs::entity_builder< Self >::add ( Second  second)
inline

Add a pair.

This operation adds a pair to the entity.

Template Parameters
FirstThe first element of the pair
Parameters
secondThe second element of the pair.

Definition at line 71 of file builder.hpp.

◆ add_if() [1/6]

template<typename Self >
template<typename T >
Self & flecs::entity_builder< Self >::add_if ( bool  cond)
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 124 of file builder.hpp.

◆ add_if() [2/6]

template<typename Self >
template<typename First , typename Second >
Self & flecs::entity_builder< Self >::add_if ( bool  cond)
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 174 of file builder.hpp.

◆ add_if() [3/6]

template<typename Self >
template<typename E , if_t< is_enum< E >::value > = 0>
Self & flecs::entity_builder< Self >::add_if ( bool  cond,
constant 
)
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 185 of file builder.hpp.

◆ add_if() [4/6]

template<typename Self >
Self & flecs::entity_builder< Self >::add_if ( bool  cond,
flecs::entity_t  first,
flecs::entity_t  second 
)
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 139 of file builder.hpp.

◆ add_if() [5/6]

template<typename Self >
template<typename First >
Self & flecs::entity_builder< Self >::add_if ( bool  cond,
flecs::entity_t  second 
)
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 162 of file builder.hpp.

◆ add_if() [6/6]

template<typename Self >
Self & flecs::entity_builder< Self >::add_if ( bool  cond,
flecs::id_t  component 
)
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 109 of file builder.hpp.

◆ add_second()

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

Add a pair.

This operation adds a pair to the entity.

Parameters
firstThe first element of the pair
Template Parameters
SecondThe second element of the pair

Definition at line 99 of file builder.hpp.

◆ child_of() [1/2]

template<typename Self >
template<typename T >
Self & flecs::entity_builder< Self >::child_of ( )
inline

Shortcut for add(ChildOf, entity).

Template Parameters
Tthe type associated with the entity.

Definition at line 246 of file builder.hpp.

◆ child_of() [2/2]

template<typename Self >
Self & flecs::entity_builder< Self >::child_of ( entity_t  second)
inline

Shortcut for add(ChildOf, entity).

Parameters
secondThe second element of the pair.

Definition at line 211 of file builder.hpp.

◆ depends_on() [1/2]

template<typename Self >
template<typename T >
Self & flecs::entity_builder< Self >::depends_on ( )
inline

Shortcut for add(DependsOn, entity).

Template Parameters
Tthe type associated with the entity.

Definition at line 255 of file builder.hpp.

◆ depends_on() [2/2]

template<typename Self >
Self & flecs::entity_builder< Self >::depends_on ( entity_t  second)
inline

Shortcut for add(DependsOn, entity).

Parameters
secondThe second element of the pair.

Definition at line 219 of file builder.hpp.

◆ disable() [1/6]

template<typename Self >
Self & flecs::entity_builder< Self >::disable ( )
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 545 of file builder.hpp.

◆ disable() [2/6]

template<typename Self >
template<typename T >
Self & flecs::entity_builder< Self >::disable ( )
inline

Disable a component.

See also
disable(flecs::id_t id)
Template Parameters
TThe component to enable.

Definition at line 620 of file builder.hpp.

◆ disable() [3/6]

template<typename Self >
template<typename First , typename Second >
Self & flecs::entity_builder< Self >::disable ( )
inline

Disable a pair.

See also
disable(flecs::id_t id)
Template Parameters
FirstThe first element of the pair.
SecondThe second element of the pair.

Definition at line 652 of file builder.hpp.

◆ disable() [4/6]

template<typename Self >
Self & flecs::entity_builder< Self >::disable ( flecs::id_t  first,
flecs::id_t  second 
)
inline

Disable a pair.

See also
disable(flecs::id_t id)
Parameters
firstThe first element of the pair.
secondThe second element of the pair.

Definition at line 630 of file builder.hpp.

◆ disable() [5/6]

template<typename Self >
Self & flecs::entity_builder< Self >::disable ( flecs::id_t  id)
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.

Definition at line 610 of file builder.hpp.

◆ disable() [6/6]

template<typename Self >
template<typename First >
Self & flecs::entity_builder< Self >::disable ( flecs::id_t  second)
inline

Disable a pair.

See also
disable(flecs::id_t id)
Template Parameters
FirstThe first element of the pair.
Parameters
secondThe second element of the pair.

Definition at line 641 of file builder.hpp.

◆ emplace() [1/2]

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

Emplace component.

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

Emplace attempts the following signatures to construct the component: T{Args...} T{flecs::entity, Args...}

If the second signature matches, emplace will pass in the current entity as argument to the constructor, which is useful if the component needs to be aware of the entity to which it has been added.

Emplace may only be called for components that have not yet been added to the entity.

Template Parameters
Tthe component to emplace
Parameters
argsThe arguments to pass to the constructor of T

Definition at line 851 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>
Self & flecs::entity_builder< Self >::emplace ( Args &&...  args)
inline

Definition at line 859 of file builder.hpp.

◆ emplace_first()

template<typename Self >
template<typename First , typename ... Args>
Self & flecs::entity_builder< Self >::emplace_first ( flecs::entity_t  second,
Args &&...  args 
)
inline

Definition at line 868 of file builder.hpp.

◆ emplace_override() [1/2]

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

Emplace component, mark component for auto-overriding.

See also
override(flecs::id_t id)
Template Parameters
TThe component to emplace and override.

Definition at line 475 of file builder.hpp.

◆ emplace_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>
Self & flecs::entity_builder< Self >::emplace_override ( Args &&...  args)
inline

Emplace pair, mark pair for auto-overriding.

See also
override(flecs::id_t id)
Template Parameters
FirstThe first element of the pair to emplace and override.
SecondThe second element of the pair to emplace and override.

Definition at line 493 of file builder.hpp.

◆ emplace_second()

template<typename Self >
template<typename Second , typename ... Args>
Self & flecs::entity_builder< Self >::emplace_second ( flecs::entity_t  first,
Args &&...  args 
)
inline

Definition at line 876 of file builder.hpp.

◆ enable() [1/6]

template<typename Self >
Self & flecs::entity_builder< Self >::enable ( )
inline

Enable an entity.

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

Definition at line 536 of file builder.hpp.

◆ enable() [2/6]

template<typename Self >
template<typename T >
Self & flecs::entity_builder< Self >::enable ( )
inline

Enable a component.

See also
enable(flecs::id_t id)
Template Parameters
TThe component to enable.

Definition at line 568 of file builder.hpp.

◆ enable() [3/6]

template<typename Self >
template<typename First , typename Second >
Self & flecs::entity_builder< Self >::enable ( )
inline

Enable a pair.

See also
enable(flecs::id_t id)
Template Parameters
FirstThe first element of the pair.
SecondThe second element of the pair.

Definition at line 600 of file builder.hpp.

◆ enable() [4/6]

template<typename Self >
Self & flecs::entity_builder< Self >::enable ( flecs::id_t  first,
flecs::id_t  second 
)
inline

Enable a pair.

See also
enable(flecs::id_t id)
Parameters
firstThe first element of the pair.
secondThe second element of the pair.

Definition at line 578 of file builder.hpp.

◆ enable() [5/6]

template<typename Self >
Self & flecs::entity_builder< Self >::enable ( flecs::id_t  id,
bool  toggle = true 
)
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).

Definition at line 557 of file builder.hpp.

◆ enable() [6/6]

template<typename Self >
template<typename First >
Self & flecs::entity_builder< Self >::enable ( flecs::id_t  second)
inline

Enable a pair.

See also
enable(flecs::id_t id)
Template Parameters
FirstThe first element of the pair.
Parameters
secondThe second element of the pair.

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

Definition at line 37 of file entity_view.hpp.

◆ is_a() [1/2]

template<typename Self >
template<typename T >
Self & flecs::entity_builder< Self >::is_a ( )
inline

Shortcut for add(IsA, entity).

Template Parameters
Tthe type associated with the entity.

Definition at line 203 of file builder.hpp.

◆ is_a() [2/2]

template<typename Self >
Self & flecs::entity_builder< Self >::is_a ( entity_t  second)
inline

Shortcut for add(IsA, entity).

Parameters
secondThe second element of the pair.

Definition at line 194 of file builder.hpp.

◆ override() [1/5]

template<typename Self >
template<typename T >
Self & flecs::entity_builder< Self >::override ( )
inline

Mark component for auto-overriding.

See also
override(flecs::id_t id)
Template Parameters
TThe component to mark for overriding.

Definition at line 371 of file builder.hpp.

◆ override() [2/5]

template<typename Self >
template<typename First , typename Second >
Self & flecs::entity_builder< Self >::override ( )
inline

Mark pair for auto-overriding.

See also
override(flecs::id_t id)
Template Parameters
FirstThe first element of the pair.
SecondThe second element of the pair.

Definition at line 393 of file builder.hpp.

◆ override() [3/5]

template<typename Self >
Self & flecs::entity_builder< Self >::override ( flecs::entity_t  first,
flecs::entity_t  second 
)
inline

Mark pair for auto-overriding.

See also
override(flecs::id_t id)
Parameters
firstThe first element of the pair.
secondThe second element of the pair.

Definition at line 361 of file builder.hpp.

◆ override() [4/5]

template<typename Self >
template<typename First >
Self & flecs::entity_builder< Self >::override ( flecs::entity_t  second)
inline

Mark pair for auto-overriding.

See also
override(flecs::id_t id)
Template Parameters
FirstThe first element of the pair.
Parameters
secondThe second element of the pair.

Definition at line 382 of file builder.hpp.

◆ override() [5/5]

template<typename Self >
Self & flecs::entity_builder< Self >::override ( flecs::id_t  id)
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
idThe id to mark for overriding.

Definition at line 351 of file builder.hpp.

◆ remove() [1/7]

template<typename Self >
template<typename T , if_not_t< is_enum< T >::value > = 0>
Self & flecs::entity_builder< Self >::remove ( )
inline

Remove a component from an entity.

Template Parameters
Tthe type of the component to remove.

Definition at line 273 of file builder.hpp.

◆ remove() [2/7]

template<typename Self >
template<typename First , typename Second >
Self & flecs::entity_builder< Self >::remove ( )
inline

Removes a pair.

This operation removes a pair from the entity.

Template Parameters
FirstThe first element of the pair
SecondThe second element of the pair

Definition at line 305 of file builder.hpp.

◆ remove() [3/7]

template<typename Self >
template<typename E , if_t< is_enum< E >::value > = 0>
Self & flecs::entity_builder< Self >::remove ( )
inline

Remove pair for enum.

This operation will remove any (Enum, *) pair from the entity.

Template Parameters
EThe enumeration type.

Definition at line 527 of file builder.hpp.

◆ remove() [4/7]

template<typename Self >
Self & flecs::entity_builder< Self >::remove ( entity_t  entity)
inline

Remove an entity from an entity.

Parameters
entityThe entity to remove.

Definition at line 282 of file builder.hpp.

◆ remove() [5/7]

template<typename Self >
Self & flecs::entity_builder< Self >::remove ( entity_t  first,
entity_t  second 
)
inline

Remove a pair.

This operation removes a pair from the entity.

Parameters
firstThe first element of the pair.
secondThe second element of the pair.

Definition at line 293 of file builder.hpp.

◆ remove() [6/7]

template<typename Self >
template<typename First , typename Second , if_t< is_enum< Second >::value > = 0>
Self & flecs::entity_builder< Self >::remove ( Second  constant)
inline

Remove a pair.

This operation adds a pair to the entity.

Template Parameters
FirstThe first element of the pair
Parameters
constantthe enum constant.

Definition at line 338 of file builder.hpp.

◆ remove() [7/7]

template<typename Self >
template<typename First , typename Second , if_not_t< is_enum< Second >::value > = 0>
Self & flecs::entity_builder< Self >::remove ( Second  second)
inline

Remove a pair.

This operation adds a pair to the entity.

Template Parameters
FirstThe first element of the pair
Parameters
secondThe second element of the pair.

Definition at line 316 of file builder.hpp.

◆ remove_second()

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

Removes a pair.

This operation removes a pair from the entity.

Template Parameters
SecondThe second element of the pair
Parameters
firstThe first element of the pair

Definition at line 327 of file builder.hpp.

◆ scope()

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

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

Definition at line 923 of file builder.hpp.

◆ set() [1/10]

template<typename Self >
template<typename T , typename A = actual_type_t<T>, if_not_t< is_callable< T >::value||is_actual< T >::value > = 0>
Self & flecs::entity_builder< Self >::set ( A &&  value)
inline

Definition at line 687 of file builder.hpp.

◆ set() [2/10]

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>
Self & flecs::entity_builder< Self >::set ( A &&  value)
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
FirstThe first element of the pair.
SecondThe second element of the pair
Parameters
valueThe value to set.

Definition at line 709 of file builder.hpp.

◆ set() [3/10]

template<typename Self >
template<typename T , typename A = actual_type_t<T>, if_not_t< is_callable< T >::value||is_actual< T >::value > = 0>
Self & flecs::entity_builder< Self >::set ( const A &  value)
inline

Definition at line 694 of file builder.hpp.

◆ set() [4/10]

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>
Self & flecs::entity_builder< Self >::set ( const A &  value)
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
FirstThe first element of the pair.
SecondThe second element of the pair
Parameters
valueThe value to set.

Definition at line 724 of file builder.hpp.

◆ set() [5/10]

template<typename Self >
template<typename Func , if_t< is_callable< Func >::value > >
Self & flecs::entity_builder< Self >::set ( const Func &  func)
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 get_mut 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 17 of file impl.hpp.

◆ set() [6/10]

template<typename Self >
template<typename T , if_t< !is_callable< T >::value &&is_actual< T >::value > = 0>
Self & flecs::entity_builder< Self >::set ( const T &  value)
inline

Definition at line 680 of file builder.hpp.

◆ set() [7/10]

template<typename Self >
template<typename First , typename Second , if_t< is_enum< Second >::value > = 0>
Self & flecs::entity_builder< Self >::set ( Second  constant,
const First &  value 
)
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
FirstThe first element of the pair.
Parameters
constantThe enum constant.
valueThe value to set.

Definition at line 770 of file builder.hpp.

◆ set() [8/10]

template<typename Self >
template<typename First , typename Second , if_not_t< is_enum< Second >::value > = 0>
Self & flecs::entity_builder< Self >::set ( Second  second,
const First &  value 
)
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
FirstThe first element of the pair.
Parameters
secondThe second element of the pair.
valueThe value to set.

Definition at line 738 of file builder.hpp.

◆ set() [9/10]

template<typename Self >
template<typename First , typename Second , if_not_t< is_enum< Second >::value > = 0>
Self & flecs::entity_builder< Self >::set ( Second  second,
First &&  value 
)
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
FirstThe first element of the pair.
Parameters
secondThe second element of the pair.
valueThe value to set.

Definition at line 754 of file builder.hpp.

◆ set() [10/10]

template<typename Self >
template<typename T , if_t< !is_callable< T >::value &&is_actual< T >::value > = 0>
Self & flecs::entity_builder< Self >::set ( T &&  value)
inline

Definition at line 673 of file builder.hpp.

◆ set_name()

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

Definition at line 932 of file builder.hpp.

◆ set_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>
Self & flecs::entity_builder< Self >::set_override ( A &&  val)
inline

Set component, mark component for auto-overriding.

See also
override(flecs::id_t id)
Template Parameters
FirstThe first element of the pair.
SecondThe second element of the pair.

Definition at line 464 of file builder.hpp.

◆ set_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>
Self & flecs::entity_builder< Self >::set_override ( const A &  val)
inline

Set component, mark component for auto-overriding.

See also
override(flecs::id_t id)
Template Parameters
FirstThe first element of the pair.
SecondThe second element of the pair.

Definition at line 451 of file builder.hpp.

◆ set_override() [3/6]

template<typename Self >
template<typename T >
Self & flecs::entity_builder< Self >::set_override ( const T &  val)
inline

Set component, mark component for auto-overriding.

See also
override(flecs::id_t id)
Template Parameters
TThe component to set and for which to add the OVERRIDE flag

Definition at line 403 of file builder.hpp.

◆ set_override() [4/6]

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

Set pair, mark component for auto-overriding.

See also
override(flecs::id_t id)
Template Parameters
FirstThe first element of the pair.
Parameters
secondThe second element of the pair.

Definition at line 426 of file builder.hpp.

◆ set_override() [5/6]

template<typename Self >
template<typename First >
Self & flecs::entity_builder< Self >::set_override ( flecs::entity_t  second,
First &&  val 
)
inline

Set pair, mark component for auto-overriding.

See also
override(flecs::id_t id)
Template Parameters
FirstThe first element of the pair.
Parameters
secondThe second element of the pair.

Definition at line 438 of file builder.hpp.

◆ set_override() [6/6]

template<typename Self >
template<typename T >
Self & flecs::entity_builder< Self >::set_override ( T &&  val)
inline

Set component, mark component for auto-overriding.

See also
override(flecs::id_t id)
Template Parameters
TThe component to set and for which to add the OVERRIDE flag

Definition at line 414 of file builder.hpp.

◆ set_ptr() [1/2]

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

Definition at line 661 of file builder.hpp.

◆ set_ptr() [2/2]

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

Definition at line 656 of file builder.hpp.

◆ set_second() [1/3]

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

Definition at line 809 of file builder.hpp.

◆ set_second() [2/3]

template<typename Self >
template<typename Second >
Self & flecs::entity_builder< Self >::set_second ( entity_t  first,
const Second &  value 
)
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
SecondThe second element of the pair
Parameters
firstThe first element of the pair.
valueThe value to set.

Definition at line 785 of file builder.hpp.

◆ set_second() [3/3]

template<typename Self >
template<typename Second >
Self & flecs::entity_builder< Self >::set_second ( entity_t  first,
Second &&  value 
)
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
SecondThe second element of the pair
Parameters
firstThe first element of the pair.
valueThe value to set.

Definition at line 801 of file builder.hpp.

◆ slot()

template<typename Self >
Self & flecs::entity_builder< Self >::slot ( )
inline

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

Definition at line 233 of file builder.hpp.

◆ slot_of() [1/2]

template<typename Self >
template<typename T >
Self & flecs::entity_builder< Self >::slot_of ( )
inline

Shortcut for add(SlotOf, entity).

Template Parameters
Tthe type associated with the entity.

Definition at line 264 of file builder.hpp.

◆ slot_of() [2/2]

template<typename Self >
Self & flecs::entity_builder< Self >::slot_of ( entity_t  second)
inline

Shortcut for add(SlotOf, entity).

Parameters
secondThe second element of the pair.

Definition at line 227 of file builder.hpp.

◆ to_base()

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

Definition at line 946 of file builder.hpp.

◆ with() [1/3]

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

Entities created in function will have the current entity.

Parameters
funcThe function to call.

Definition at line 888 of file builder.hpp.

◆ with() [2/3]

template<typename Self >
template<typename First , typename Func >
Self & flecs::entity_builder< Self >::with ( const Func &  func)
inline

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

This operation is thread safe.

Template Parameters
FirstThe first element of the pair
Parameters
funcThe function to call.

Definition at line 902 of file builder.hpp.

◆ with() [3/3]

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

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

Parameters
firstThe first element of the pair.
funcThe function to call.

Definition at line 913 of file builder.hpp.


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