21template<
typename Base>
31 this->assert_term_ref();
38 this->assert_term_ref();
52 this->assert_term_ref();
59 this->assert_term_ref();
66 Base&
var(
const char *var_name) {
67 this->assert_term_ref();
75 this->assert_term_ref();
86 void assert_term_ref() {
88 "no active term (call .with() first)");
93 return *
static_cast<Base*
>(
this);
102template<
typename Base>
160 if (name[0] ==
'$') {
187 if (name[0] ==
'$') {
214 if (name[0] ==
'$') {
226 this->assert_term_ref();
228 "up traversal can only be applied to term source");
230 "up traversal can only be applied to term source");
240 template <
typename Trav>
248 this->assert_term_ref();
258 template <
typename Trav>
265 this->assert_term_ref();
277 this->assert_term_ref();
309 this->
src().entity(0);
423 "no active term (call .with() first)");
427 return *
static_cast<Base*
>(
this);
#define ecs_assert(condition, error_code,...)
Assert.
#define ECS_INVALID_PARAMETER
Invalid parameter error code.
#define ecs_check(condition, error_code,...)
Check.
ecs_flags64_t flags64_t
64-bit flags type.
oper_kind_t
Operator kind.
ecs_entity_t entity_t
Entity type.
ecs_flags32_t flags32_t
32-bit flags type.
ecs_world_t world_t
World type.
@ NotFrom
NotFrom operator.
@ AndFrom
AndFrom operator.
@ Optional
Optional operator.
@ EcsInOutFilter
Same as InOutNone + prevents term from triggering observers.
@ EcsNot
The term must not match.
Compile-time utilities for deriving query attributes from a parameter pack.
Type that describes a reference to an entity or variable in a term.
ecs_entity_t id
Entity ID.
Type that describes a term (single element in a query).
ecs_term_ref_t src
Source of term.
ecs_id_t id
Component ID to be matched by term.
int16_t oper
Operator of term.
ecs_term_ref_t second
Second element of pair.
ecs_entity_t trav
Relationship to traverse when looking for the component.
int16_t inout
Access to contents matched by term.
ecs_term_ref_t first
Component or first element of pair.
Base & filter()
Mark the term as a filter.
Base & inout(flecs::inout_kind_t inout)
Set read/write access of the term.
Base & or_from()
Short for oper(flecs::OrFrom).
void set_term(ecs_term_t *term)
Set the current term pointer.
Base & second(flecs::entity_t id)
Select the second identifier, initialize it with an entity ID.
Base & cascade(flecs::entity_t trav=0)
The cascade flag is like up(), but returns results in breadth-first order.
Base & oper(flecs::oper_kind_t oper)
Set the operator of the term.
Base & first(const char *name)
Select the first identifier, initialize it with a name.
Base & read_write()
Short for inout_stage(flecs::InOut).
Base & term(id_t id)
Set the term ID.
Base & parent()
Same as up().
Base & inout()
Short for inout(flecs::InOut).
Base & desc()
Use with cascade() to iterate results in descending (bottom-to-top) order.
Base & in()
Short for inout(flecs::In).
Base & inout_stage(flecs::inout_kind_t inout)
Set read/write access for a stage.
Base & trav(flecs::entity_t trav, flecs::flags32_t flags=0)
Specify the relationship to traverse, and flags to indicate direction.
Base & or_()
Short for oper(flecs::Or).
Base & first()
Select the first identifier, initialize it with the ID associated with the type.
Base & second()
Select the second identifier, initialize it with the ID associated with the type.
Base & src()
Call prior to setting values for the src identifier.
Base & and_from()
Short for oper(flecs::AndFrom).
Base & src()
Select the src identifier, initialize it with the ID associated with the type.
Base & out()
Short for inout(flecs::Out).
Base & up()
Traverse upwards using the specified relationship type.
Base & and_()
Short for oper(flecs::And).
ecs_term_t * term_
Pointer to the current term.
Base & optional()
Short for oper(flecs::Optional).
Base & cascade()
Cascade using the specified relationship type.
Base & second()
Call prior to setting values for the second identifier.
Base & src(flecs::entity_t id)
Select the src identifier, initialize it with an entity ID.
Base & read()
Short for inout_stage(flecs::In).
term_builder_i(ecs_term_t *term_ptr)
Construct from a term pointer.
Base & up(flecs::entity_t trav=0)
The up flag indicates that the term identifier may be substituted by traversing a relationship upward...
Base & first(flecs::entity_t id)
Select the first identifier, initialize it with an entity ID.
Base & inout_none()
Short for inout(flecs::InOutNone).
term_builder_i()
Default constructor.
Base & src(const char *name)
Select the src identifier, initialize it with a name.
Base & id_flags(id_t flags)
Set ID flags for the term.
Base & second(const char *name)
Select the second identifier, initialize it with a name.
Base & not_from()
Short for oper(flecs::NotFrom).
Base & not_()
Short for oper(flecs::Not).
Base & write()
Short for inout_stage(flecs::Out).
Base & first()
Call prior to setting values for the first identifier.
Base & name(const char *name)
Specify the value of the identifier by name.
Base & id(flecs::entity_t id)
Specify the value of the identifier by ID.
ecs_term_ref_t * term_ref_
Pointer to the current term reference.
virtual ~term_ref_builder_i()
Destructor.
Base & entity(flecs::entity_t entity)
Specify the value of the identifier by ID.
Base & var(const char *var_name)
Specify that the identifier is a variable (resolved at query evaluation time).
Base & self()
The self flag indicates that the term identifier itself is used.
Base & flags(flecs::flags64_t flags)
Override the term ID flags.
term_ref_builder_i()
Default constructor.
Class that describes a term.