GATE
structs.h File Reference

Generic data-struct management and reflection. More...

#include "gate/gate_core_api.h"
#include "gate/gatetypes.h"
#include "gate/strings.h"
#include "gate/typeids.h"

Classes

struct  gate_struct_item
 
struct  gate_struct_descriptor
 
struct  gate_struct
 

Macros

#define GATE_STRUCT_FLAG_DEFAULT   0x0000
 
#define GATE_STRUCT_FLAG_OPTIONAL   0x0001
 
#define GATE_STRUCT_ITEM(struct_type, item_type, member)    { item_type, offsetof(struct_type, member), #member, NULL, 0 }
 
#define GATE_STRUCT_ITEM_EX(struct_type, item_type, member, descr, flags)    { item_type, offsetof(struct_type, member), #member, descr, flags }
 
#define GATE_STRUCT_DESCRIPTOR(type, name, items)
 
#define GATE_STRUCT_ROOT_NAME   "struct"
 
#define GATE_STRUCT_SEPARATOR   "/"
 

Typedefs

typedef struct gate_struct_item gate_struct_item_t
 
typedef struct gate_struct_descriptor gate_struct_descriptor_t
 
typedef struct gate_struct gate_struct_t
 
typedef gate_struct_tgate_struct_ptr_t
 

Functions

GATE_CORE_API gate_result_t gate_struct_init (gate_struct_t *obj, gate_struct_descriptor_t const *descriptor)
 
GATE_CORE_API gate_result_t gate_struct_copy (gate_struct_t *dst, gate_struct_t const *src)
 
GATE_CORE_API gate_size_t gate_struct_length (gate_struct_t const *src)
 
GATE_CORE_API char const * gate_struct_get_name (gate_struct_t const *src)
 
GATE_CORE_API gate_size_t gate_struct_get_member_count (gate_struct_t const *src)
 
GATE_CORE_API gate_type_id_t gate_struct_get_member_type (gate_struct_t const *src, gate_size_t index)
 
GATE_CORE_API gate_type_id_t gate_struct_get_member_type_by_name (gate_struct_t const *src, char const *name)
 
GATE_CORE_API gate_type_id_t gate_struct_get_member_type_by_string (gate_struct_t const *src, gate_string_t const *name)
 
GATE_CORE_API char const * gate_struct_get_member_name (gate_struct_t const *src, gate_size_t index)
 
GATE_CORE_API void const * gate_struct_get_member (gate_struct_t const *src, gate_size_t index)
 
GATE_CORE_API void const * gate_struct_get_member_by_name (gate_struct_t const *src, char const *name)
 
GATE_CORE_API void const * gate_struct_get_member_by_string (gate_struct_t const *src, gate_string_t const *name)
 
GATE_CORE_API gate_result_t gate_struct_release (gate_struct_ptr_t obj)
 
GATE_CORE_API gate_result_t gate_struct_item_init (gate_uint16_t type, void *ptr)
 
GATE_CORE_API gate_result_t gate_struct_item_release (gate_uint16_t type, void *ptr)
 
GATE_CORE_API gate_result_t gate_struct_copy_constructor (void *dest, void const *src)
 
GATE_CORE_API void gate_struct_destructor (void *dest)
 

Detailed Description

Generic data-struct management and reflection.

Macro Definition Documentation

◆ GATE_STRUCT_DESCRIPTOR

#define GATE_STRUCT_DESCRIPTOR ( type,
name,
items )
Value:
{ \
name, &items[0], sizeof(items) / sizeof(items[0]), sizeof(type) \
}