(my)TinyLibC 0.0.1
little tiny pretty lib c
Loading...
Searching...
No Matches
tlcdico.h
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2023
3** (My) Tiny Lib C
4** File description:
5** dico header
6*/
7
8#ifndef TLS_DICO_H_
9 #define TLS_DICO_H_
10
11 #include <tlcllists.h>
12
13struct dico_s {
14 list_t *interns;
15};
16typedef struct dico_s dico_t;
17
19 char key[256];
20 void *value;
21 void (*destroy)(void *value);
22};
23typedef struct dico_node_s dico_node_t;
24
30dico_t *dico_create(void);
31
37void dico_destroy(dico_t *dico);
38
49dico_t *dico_add(dico_t *dico, char const *key,
50 void *value, void (*destroy)(void *value));
51
60dico_t *dico_add_elem(dico_t *dico, dico_node_t *elem);
61
70void *dico_pop_value(dico_t *dico, char const *key);
71
80dico_node_t *dico_pop_elem(dico_t *dico, char const *key);
81
90void *dico_get_value(dico_t *dico, char const *key);
91
100dico_node_t *dico_get_elem(dico_t *dico, char const *key);
101
110dico_node_t *dico_get_elem_ptr(dico_t *dico, void *value);
111
120dico_t *dico_rem(dico_t *dico, char const *key);
121
130dico_t *dico_rem_ptr(dico_t *dico, void *value);
131
132#endif
void * value
Definition tlcdico.h:20
char key[256]
Definition tlcdico.h:19
void(* destroy)(void *value)
Definition tlcdico.h:21
list_t * interns
Definition tlcdico.h:14
dico_node_t * dico_get_elem_ptr(dico_t *dico, void *value)
Get node where value equal value in node.
dico_t * dico_create(void)
create a new dico
dico_t * dico_rem_ptr(dico_t *dico, void *value)
Rem a key and its value.
dico_t * dico_add(dico_t *dico, char const *key, void *value, void(*destroy)(void *value))
add a key/value
void * dico_get_value(dico_t *dico, char const *key)
Get value of pair key.
void dico_destroy(dico_t *dico)
delete a dico
dico_t * dico_add_elem(dico_t *dico, dico_node_t *elem)
add an elem (key/value/destroy)
dico_node_t * dico_get_elem(dico_t *dico, char const *key)
Get node of pair key.
dico_t * dico_rem(dico_t *dico, char const *key)
Rem a key and its value.
void * dico_pop_value(dico_t *dico, char const *key)
remove a key and return the value
dico_node_t * dico_pop_elem(dico_t *dico, char const *key)
remove a key and return the node