Skip to content
Flecs v4.1
query.inl
Go to the documentation of this file.
1/**
2 * @file addons/cpp/mixins/json/query.inl
3 * @brief JSON query mixin.
4 */
5
6/** Serialize a query to JSON.
7 *
8 * @memberof flecs::query_base
9 * @ingroup cpp_addons_json
10 */
11flecs::string to_json(flecs::iter_to_json_desc_t *desc = nullptr) {
12 ecs_iter_t it = ecs_query_iter(ecs_get_world(query_), query_);
13 char *json = ecs_iter_to_json(&it, desc);
14 return flecs::string(json);
15}
FLECS_API char * ecs_iter_to_json(ecs_iter_t *iter, const ecs_iter_to_json_desc_t *desc)
Serialize iterator into JSON string.
ecs_iter_t ecs_query_iter(const ecs_world_t *world, const ecs_query_t *query)
Create a query iterator.
const ecs_world_t * ecs_get_world(const ecs_poly_t *poly)
Get the world from a poly.
Iterator.
Definition flecs.h:1192
flecs::string to_json(flecs::iter_to_json_desc_t *desc=nullptr)
Serialize a query to JSON.
Definition query.inl:11
Owned string wrapper.
Definition string.hpp:15