Flecs v3.1
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
world.inl
Go to the documentation of this file.
1
11flecs::string to_json(flecs::entity_t tid, const void* value) {
12 char *json = ecs_ptr_to_json(m_world, tid, value);
13 return flecs::string(json);
14}
15
21template <typename T>
22flecs::string to_json(const T* value) {
23 flecs::entity_t tid = _::cpp_type<T>::id(m_world);
24 return to_json(tid, value);
25}
26
33 return flecs::string( ecs_world_to_json(m_world) );
34}
35
41template <typename T>
42const char* from_json(flecs::entity_t tid, void* value, const char *json) {
43 return ecs_ptr_from_json(m_world, tid, value, json, nullptr);
44}
45
51template <typename T>
52const char* from_json(T* value, const char *json) {
53 return ecs_ptr_from_json(m_world, _::cpp_type<T>::id(m_world),
54 value, json, NULL);
55}
FLECS_API char * ecs_world_to_json(ecs_world_t *world)
Serialize world into JSON string.
FLECS_API char * ecs_ptr_to_json(const ecs_world_t *world, ecs_entity_t type, const void *data)
Serialize value into JSON string.
FLECS_API const char * ecs_ptr_from_json(const ecs_world_t *world, ecs_entity_t type, void *ptr, const char *json, const ecs_from_json_desc_t *desc)
Parse JSON string into value.
flecs::string to_json(const T *value)
Serialize value to JSON.
Definition: world.inl:22
flecs::string to_json()
Serialize world to JSON.
Definition: world.inl:32
const char * from_json(flecs::entity_t tid, void *value, const char *json)
Deserialize value from JSON.
Definition: world.inl:42
const char * from_json(T *value, const char *json)
Deserialize value from JSON.
Definition: world.inl:52
flecs::string to_json(flecs::entity_t tid, const void *value)
Serialize untyped value to JSON.
Definition: world.inl:11