Flecs: Queries
Description: A fast entity component system (ECS) for C & C++

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

Loading...
Searching...
No Matches
Classes
Queries
C++ API » Core
Collaboration diagram for Queries:

## Classes
struct | flecs::query_builder< Components >
| Query builder. More...
struct | flecs::query_builder_i< Base, Components >
| Query builder interface. More...
struct | flecs::query< Components >
struct | flecs::term_ref_builder_i< Base >
| Term identifier builder. More...
struct | flecs::term_builder_i< Base >
| Term builder interface. More...
struct | flecs::term
| Class that describes a term. More...
template<typename... Args>
flecs::term | flecs::world::term (Args &&... args) const
| Create a term.
template<typename T>
flecs::term | term () const
| Create a term for a (component) type.
template<typename First, typename Second>
flecs::term | term () const
| Create a term for a pair.
template<typename... Comps, typename... Args>
flecs::query< Comps... > | flecs::world::query (Args &&... args) const
| Create a query.
flecs::query | query (flecs::entity query_entity) const
| Create a query from entity.
template<typename... Comps, typename... Args>
flecs::query_builder< Comps... > | query_builder (Args &&... args) const
| Create a query builder.
template<typename Func>
void | each (Func &&func) const
| Iterate over all entities with components in argument list of function.
template<typename T, typename Func>
void | each (Func &&func) const
| Iterate over all entities with provided component.
template<typename Func>
void | each (flecs::id_t term_id, Func &&func) const
| Iterate over all entities with provided (component) id.

## Detailed Description

## Function Documentation

## ◆ each() [1/3]

template<typename Func>

void flecs::world::each | ( | flecs::id_t | term_id,
|  | Func && | func ) const
| related

Iterate over all entities with provided (component) id.

Definition at line 316 of file impl.hpp.

## ◆ each() [2/3]

template<typename Func>

void flecs::world::each | ( | Func && | func | ) | const
| related

Iterate over all entities with components in argument list of function.

The function parameter must match the following signature:

void(*)(T&, U&, ...)

or:

void(*)(flecs::entity, T&, U&, ...)
flecs::entity
Entity.
Definition entity.hpp:30

Definition at line 302 of file impl.hpp.

## ◆ each() [3/3]

template<typename T, typename Func>

void flecs::world::each | ( | Func && | func | ) | const
| related

Iterate over all entities with provided component.

The function parameter must match the following signature:

void(*)(T&)

or:

void(*)(flecs::entity, T&)

Definition at line 307 of file impl.hpp.

## ◆ query() [1/2]

template<typename... Comps, typename... Args>

flecs::query< Comps... > flecs::world::query | ( | Args &&... | args | ) | const
| inline

Create a query.

See also
  ecs_query_init

Definition at line 236 of file impl.hpp.

## ◆ query() [2/2]

flecs::query flecs::world::query | ( | flecs::entity | query_entity | ) | const
| related

Create a query from entity.

See also
  ecs_query_init

Definition at line 241 of file impl.hpp.

## ◆ query_builder()

template<typename... Comps, typename... Args>

flecs::query_builder< Comps... > flecs::world::query_builder | ( | Args &&... | args | ) | const
| related

Create a query builder.

See also
  ecs_query_init

Definition at line 248 of file impl.hpp.

## ◆ term() [1/3]

template<typename T>

flecs::term flecs::world::term | ( |  | ) | const
| related

Create a term for a (component) type.

Definition at line 126 of file impl.hpp.

## ◆ term() [2/3]

template<typename First, typename Second>

flecs::term flecs::world::term | ( |  | ) | const
| related

Create a term for a pair.

Definition at line 131 of file impl.hpp.

## ◆ term() [3/3]

template<typename... Args>

flecs::term flecs::world::term | ( | Args &&... | args | ) | const
| inline

Create a term.

Definition at line 121 of file impl.hpp.