![]() |
Flecs v4.0
A fast entity component system (ECS) for C & C++
|
Functions for working with ecs_id_t
.
More...
Functions | |
bool | ecs_id_is_tag (const ecs_world_t *world, ecs_id_t component) |
Returns whether specified component is a tag. | |
bool | ecs_id_in_use (const ecs_world_t *world, ecs_id_t component) |
Returns whether specified component is in use. | |
ecs_entity_t | ecs_get_typeid (const ecs_world_t *world, ecs_id_t component) |
Get the type for a component. | |
bool | ecs_id_match (ecs_id_t component, ecs_id_t pattern) |
Utility to match a component with a pattern. | |
bool | ecs_id_is_pair (ecs_id_t component) |
Utility to check if component is a pair. | |
bool | ecs_id_is_wildcard (ecs_id_t component) |
Utility to check if component is a wildcard. | |
bool | ecs_id_is_any (ecs_id_t component) |
Utility to check if component is an any wildcard. | |
bool | ecs_id_is_valid (const ecs_world_t *world, ecs_id_t component) |
Utility to check if id is valid. | |
ecs_flags32_t | ecs_id_get_flags (const ecs_world_t *world, ecs_id_t component) |
Get flags associated with id. | |
const char * | ecs_id_flag_str (ecs_id_t component_flags) |
Convert component flag to string. | |
char * | ecs_id_str (const ecs_world_t *world, ecs_id_t component) |
Convert component id to string. | |
void | ecs_id_str_buf (const ecs_world_t *world, ecs_id_t component, ecs_strbuf_t *buf) |
Write component string to buffer. | |
ecs_id_t | ecs_id_from_str (const ecs_world_t *world, const char *expr) |
Convert string to a component. | |
Functions for working with ecs_id_t
.
ecs_entity_t ecs_get_typeid | ( | const ecs_world_t * | world, |
ecs_id_t | component ) |
Get the type for a component.
This operation returns the type for a component id, if the id is associated with a type. For a regular component with a non-zero size (an entity with the EcsComponent component) the operation will return the component id itself.
For an entity that does not have the EcsComponent component, or with an EcsComponent value with size 0, the operation will return 0.
For a pair id the operation will return the type associated with the pair, by applying the following queries in order:
world | The world. |
component | The component. |
const char * ecs_id_flag_str | ( | ecs_id_t | component_flags | ) |
Convert component flag to string.
This operation converts a component flag to a string. Possible outputs are:
component_flags | The component flag. |
ecs_id_t ecs_id_from_str | ( | const ecs_world_t * | world, |
const char * | expr ) |
Convert string to a component.
This operation is the reverse of ecs_id_str(). The FLECS_SCRIPT addon is required for this operation to work.
world | The world. |
expr | The string to convert to an id. |
ecs_flags32_t ecs_id_get_flags | ( | const ecs_world_t * | world, |
ecs_id_t | component ) |
Get flags associated with id.
This operation returns the internal flags (see api_flags.h) that are associated with the provided id.
world | The world. |
component | The component. |
bool ecs_id_in_use | ( | const ecs_world_t * | world, |
ecs_id_t | component ) |
Returns whether specified component is in use.
This operation returns whether a component is in use in the world. A component is in use if it has been added to one or more tables.
world | The world. |
component | The component. |
bool ecs_id_is_any | ( | ecs_id_t | component | ) |
Utility to check if component is an any wildcard.
component | The component. |
bool ecs_id_is_pair | ( | ecs_id_t | component | ) |
Utility to check if component is a pair.
component | The component. |
bool ecs_id_is_tag | ( | const ecs_world_t * | world, |
ecs_id_t | component ) |
Returns whether specified component is a tag.
This operation returns whether the specified component is a tag (a component without data/size).
An id is a tag when:
world | The world. |
component | The component. |
bool ecs_id_is_valid | ( | const ecs_world_t * | world, |
ecs_id_t | component ) |
Utility to check if id is valid.
A valid id is an id that can be added to an entity. Invalid ids are:
Note that the same rules apply to removing from an entity, with the exception of wildcards.
world | The world. |
component | The component. |
bool ecs_id_is_wildcard | ( | ecs_id_t | component | ) |
Utility to check if component is a wildcard.
component | The component. |
Utility to match a component with a pattern.
This operation returns true if the provided pattern matches the provided component. The pattern may contain a wildcard (or wildcards, when a pair).
component | The component. |
pattern | The pattern to compare with. |
char * ecs_id_str | ( | const ecs_world_t * | world, |
ecs_id_t | component ) |
Convert component id to string.
This operation converts the provided component id to a string. It can output strings of the following formats:
The PAIR flag never added to the string.
world | The world. |
component | The component to convert to a string. |
void ecs_id_str_buf | ( | const ecs_world_t * | world, |
ecs_id_t | component, | ||
ecs_strbuf_t * | buf ) |
Write component string to buffer.
Same as ecs_id_str() but writes result to ecs_strbuf_t.
world | The world. |
component | The component to convert to a string. |
buf | The buffer to write to. |