-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_ht.h
61 lines (52 loc) · 950 Bytes
/
ft_ht.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef FT_HT_H
# define FT_HT_H
# include <stdlib.h>
typedef struct s_item
{
char *key;
char *value;
} t_ht_item;
typedef struct s_hash_table
{
int size;
int base_size;
int count;
t_ht_item **items;
} t_ht_table;
/**
* To initialize new hash table.
*
* @return t_ht_table* ht
*/
t_ht_table *ht_new(void);
/**
* To insert new item to hash table.
*
* @param t_ht_table* ht
* @param const char* key
* @param const char* value
*/
void ht_insert(t_ht_table *ht, const char *key, const char *value);
/**
* To search value by key.
*
* @param t_ht_table* ht
* @param const char* key
*
* @return char* value
*/
char *ht_search(t_ht_table *ht, const char *key);
/**
* To delete item from hash table.
*
* @param t_ht_table* ht
* @param const char* key
*/
void ht_delete(t_ht_table *ht, const char *key);
/**
* To delete hash table.
*
* @param t_ht_table* ht
*/
void ht_del_table(t_ht_table *ht);
#endif