Flecs v3.2
A fast entity component system (ECS) for C & C++
|
Flecs expression parser addon. More...
Go to the source code of this file.
Classes | |
struct | ecs_expr_var_t |
Storage for parser variables. More... | |
struct | ecs_expr_var_scope_t |
struct | ecs_vars_t |
struct | ecs_parse_expr_desc_t |
Used with ecs_parse_expr(). More... | |
Typedefs | |
typedef struct ecs_expr_var_t | ecs_expr_var_t |
Storage for parser variables. | |
typedef struct ecs_expr_var_scope_t | ecs_expr_var_scope_t |
typedef struct ecs_vars_t | ecs_vars_t |
typedef struct ecs_parse_expr_desc_t | ecs_parse_expr_desc_t |
Used with ecs_parse_expr(). | |
Functions | |
FLECS_API char * | ecs_chresc (char *out, char in, char delimiter) |
Write an escaped character. | |
const char * | ecs_chrparse (const char *in, char *out) |
Parse an escaped character. | |
FLECS_API ecs_size_t | ecs_stresc (char *out, ecs_size_t size, char delimiter, const char *in) |
Write an escaped string. | |
FLECS_API char * | ecs_astresc (char delimiter, const char *in) |
Return escaped string. | |
FLECS_API void | ecs_vars_init (ecs_world_t *world, ecs_vars_t *vars) |
Init variable storage. | |
FLECS_API void | ecs_vars_fini (ecs_vars_t *vars) |
Cleanup variable storage. | |
FLECS_API void | ecs_vars_push (ecs_vars_t *vars) |
Push variable scope. | |
FLECS_API int | ecs_vars_pop (ecs_vars_t *vars) |
Pop variable scope. | |
FLECS_API ecs_expr_var_t * | ecs_vars_declare (ecs_vars_t *vars, const char *name, ecs_entity_t type) |
Declare variable in current scope. | |
FLECS_API ecs_expr_var_t * | ecs_vars_declare_w_value (ecs_vars_t *vars, const char *name, ecs_value_t *value) |
Declare variable in current scope from value. | |
FLECS_API ecs_expr_var_t * | ecs_vars_lookup (const ecs_vars_t *vars, const char *name) |
Lookup variable in scope and parent scopes. | |
FLECS_API const char * | ecs_parse_expr (ecs_world_t *world, const char *ptr, ecs_value_t *value, const ecs_parse_expr_desc_t *desc) |
Parse expression into value. | |
FLECS_API char * | ecs_ptr_to_expr (const ecs_world_t *world, ecs_entity_t type, const void *data) |
Serialize value into expression string. | |
FLECS_API int | ecs_ptr_to_expr_buf (const ecs_world_t *world, ecs_entity_t type, const void *data, ecs_strbuf_t *buf) |
Serialize value into expression buffer. | |
FLECS_API char * | ecs_ptr_to_str (const ecs_world_t *world, ecs_entity_t type, const void *data) |
Similar as ecs_ptr_to_expr(), but serializes values to string. | |
FLECS_API int | ecs_ptr_to_str_buf (const ecs_world_t *world, ecs_entity_t type, const void *data, ecs_strbuf_t *buf) |
Serialize value into string buffer. | |
FLECS_API int | ecs_primitive_to_expr_buf (const ecs_world_t *world, ecs_primitive_kind_t kind, const void *data, ecs_strbuf_t *buf) |
Serialize primitive value into string buffer. | |
FLECS_API const char * | ecs_parse_expr_token (const char *name, const char *expr, const char *ptr, char *token) |
Parse expression token. | |
FLECS_API char * | ecs_interpolate_string (ecs_world_t *world, const char *str, const ecs_vars_t *vars) |
Evaluate interpolated expressions in string. | |
FLECS_API void | ecs_iter_to_vars (const ecs_iter_t *it, ecs_vars_t *vars, int offset) |
Convert iterator to vars This operation converts an iterator to a variable array. | |
Flecs expression parser addon.
Parse expression strings into component values. The notation is similar to JSON but with a smaller footprint, native support for (large) integer types, character types, enumerations, bitmasks and entity identifiers.
Examples:
Member names:
{x: 10, y: 20}
No member names (uses member ordering):
{10, 20}
Enum values:
{color: Red}
Bitmask values:
{toppings: Lettuce|Tomato}
Collections:
{points: [10, 20, 30]}
Nested objects:
{start: {x: 10, y: 20}, stop: {x: 30, y: 40}}
Definition in file expr.h.