libcdsb/include/set.h

60 lines
4.4 KiB
C
Raw Normal View History

2022-06-06 11:23:33 +03:00
/* This software is licensed by the MIT License, see LICENSE file */
/* Copyright © 2022 Gregory Lirent */
#include "__generics.h"
#include "vtype.h"
#ifndef LIBCDSB_SET_H
#define LIBCDSB_SET_H
2022-06-08 20:59:46 +03:00
typedef int (*vset_access_callback)(const void* value, vtype type, void* data);
2022-06-06 11:23:33 +03:00
extern void vset_init(vtype_set* x, vtype type);
2022-06-06 23:47:26 +03:00
#define vset_remove(x, value) _LIBCDSB_Generic (libcdsb_vset, touch, value)(x, value, 1)
#define vset_push(x, value) _LIBCDSB_Generic (libcdsb_vset, push, value)(x, value)
2022-06-06 11:23:33 +03:00
2022-06-06 23:47:26 +03:00
#define in_vset(x, value) _LIBCDSB_Generic (libcdsb_vset, touch, value)(x, value, 0)
2022-06-06 11:23:33 +03:00
2022-06-09 16:29:10 +03:00
extern bool libcdsb_vset_push_pointer(vtype_set* x, const void* value);
extern bool libcdsb_vset_push_cstring(vtype_set* x, const char* value);
extern bool libcdsb_vset_push_string (vtype_set* x, const vtype_string* value);
extern bool libcdsb_vset_push_array (vtype_set* x, const vtype_array* value);
extern bool libcdsb_vset_push_list (vtype_set* x, const vtype_list* value);
extern bool libcdsb_vset_push_map (vtype_set* x, const vtype_map* value);
extern bool libcdsb_vset_push_vset (vtype_set* x, const vtype_set* value);
extern bool libcdsb_vset_push_boolean(vtype_set* x, vtype_bool value);
extern bool libcdsb_vset_push_uint8 (vtype_set* x, vtype_uint8 value);
extern bool libcdsb_vset_push_uint16 (vtype_set* x, vtype_uint16 value);
extern bool libcdsb_vset_push_uint32 (vtype_set* x, vtype_uint32 value);
extern bool libcdsb_vset_push_uint64 (vtype_set* x, vtype_uint64 value);
extern bool libcdsb_vset_push_int8 (vtype_set* x, vtype_int8 value);
extern bool libcdsb_vset_push_int16 (vtype_set* x, vtype_int16 value);
extern bool libcdsb_vset_push_int32 (vtype_set* x, vtype_int32 value);
extern bool libcdsb_vset_push_int64 (vtype_set* x, vtype_int64 value);
extern bool libcdsb_vset_push_float (vtype_set* x, vtype_float value);
extern bool libcdsb_vset_push_double (vtype_set* x, vtype_double value);
extern bool libcdsb_vset_push_ldouble(vtype_set* x, vtype_ldouble value);
extern int libcdsb_vset_find_pointer(vtype_set* x, const void* value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_cstring(vtype_set* x, const char* value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_string (vtype_set* x, const vtype_string* value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_array (vtype_set* x, const vtype_array* value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_list (vtype_set* x, const vtype_list* value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_map (vtype_set* x, const vtype_map* value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_vset (vtype_set* x, const vtype_set* value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_boolean(vtype_set* x, vtype_bool value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_uint8 (vtype_set* x, vtype_uint8 value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_uint16 (vtype_set* x, vtype_uint16 value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_uint32 (vtype_set* x, vtype_uint32 value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_uint64 (vtype_set* x, vtype_uint64 value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_int8 (vtype_set* x, vtype_int8 value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_int16 (vtype_set* x, vtype_int16 value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_int32 (vtype_set* x, vtype_int32 value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_int64 (vtype_set* x, vtype_int64 value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_float (vtype_set* x, vtype_float value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_double (vtype_set* x, vtype_double value, void* data, vset_access_callback, bool cut);
extern int libcdsb_vset_find_ldouble(vtype_set* x, vtype_ldouble value, void* data, vset_access_callback, bool cut);
2022-06-06 11:23:33 +03:00
#endif /* LIBCDSB_SET_H */