libcdsb/include/set.h

62 lines
5.2 KiB
C

/* 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
typedef int (*vset_access_callback)(const void* value, vtype type, void* data);
extern void vset_init(vtype_set* x, vtype type) Nonnull__(1);
#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)
#define in_vset(x, value) _LIBCDSB_Generic (libcdsb_vset, touch, value)(x, value, 0)
extern bool libcdsb_vset_push_pointer(vtype_set* x, const void* value) Nonnull__(1);
extern bool libcdsb_vset_push_cstring(vtype_set* x, const char* value) Nonnull__(1,2);
extern bool libcdsb_vset_push_string (vtype_set* x, const vtype_string* value) Nonnull__(1,2);
extern bool libcdsb_vset_push_array (vtype_set* x, const vtype_array* value) Nonnull__(1,2);
extern bool libcdsb_vset_push_list (vtype_set* x, const vtype_list* value) Nonnull__(1,2);
extern bool libcdsb_vset_push_map (vtype_set* x, const vtype_map* value) Nonnull__(1,2);
extern bool libcdsb_vset_push_vset (vtype_set* x, const vtype_set* value) Nonnull__(1,2);
extern bool libcdsb_vset_push_dict (vtype_set* x, const vtype_dict* value) Nonnull__(1,2);
extern bool libcdsb_vset_push_boolean(vtype_set* x, vtype_bool value) Nonnull__(1);
extern bool libcdsb_vset_push_uint8 (vtype_set* x, vtype_uint8 value) Nonnull__(1);
extern bool libcdsb_vset_push_uint16 (vtype_set* x, vtype_uint16 value) Nonnull__(1);
extern bool libcdsb_vset_push_uint32 (vtype_set* x, vtype_uint32 value) Nonnull__(1);
extern bool libcdsb_vset_push_uint64 (vtype_set* x, vtype_uint64 value) Nonnull__(1);
extern bool libcdsb_vset_push_int8 (vtype_set* x, vtype_int8 value) Nonnull__(1);
extern bool libcdsb_vset_push_int16 (vtype_set* x, vtype_int16 value) Nonnull__(1);
extern bool libcdsb_vset_push_int32 (vtype_set* x, vtype_int32 value) Nonnull__(1);
extern bool libcdsb_vset_push_int64 (vtype_set* x, vtype_int64 value) Nonnull__(1);
extern bool libcdsb_vset_push_float (vtype_set* x, vtype_float value) Nonnull__(1);
extern bool libcdsb_vset_push_double (vtype_set* x, vtype_double value) Nonnull__(1);
extern bool libcdsb_vset_push_ldouble(vtype_set* x, vtype_ldouble value) Nonnull__(1);
extern int libcdsb_vset_find_pointer(vtype_set* x, const void* value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_cstring(vtype_set* x, const char* value, void* data, vset_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_vset_find_string (vtype_set* x, const vtype_string* value, void* data, vset_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_vset_find_array (vtype_set* x, const vtype_array* value, void* data, vset_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_vset_find_list (vtype_set* x, const vtype_list* value, void* data, vset_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_vset_find_map (vtype_set* x, const vtype_map* value, void* data, vset_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_vset_find_vset (vtype_set* x, const vtype_set* value, void* data, vset_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_vset_find_dict (vtype_set* x, const vtype_dict* value, void* data, vset_access_callback, bool cut) Nonnull__(1,2);
extern int libcdsb_vset_find_boolean(vtype_set* x, vtype_bool value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_uint8 (vtype_set* x, vtype_uint8 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_uint16 (vtype_set* x, vtype_uint16 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_uint32 (vtype_set* x, vtype_uint32 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_uint64 (vtype_set* x, vtype_uint64 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_int8 (vtype_set* x, vtype_int8 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_int16 (vtype_set* x, vtype_int16 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_int32 (vtype_set* x, vtype_int32 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_int64 (vtype_set* x, vtype_int64 value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_float (vtype_set* x, vtype_float value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_double (vtype_set* x, vtype_double value, void* data, vset_access_callback, bool cut) Nonnull__(1);
extern int libcdsb_vset_find_ldouble(vtype_set* x, vtype_ldouble value, void* data, vset_access_callback, bool cut) Nonnull__(1);
#endif /* LIBCDSB_SET_H */