aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ft_lst.h5
-rw-r--r--include/ft_types.h3
-rw-r--r--include/libft_ht.h53
3 files changed, 59 insertions, 2 deletions
diff --git a/include/ft_lst.h b/include/ft_lst.h
index 134df71..23fb192 100644
--- a/include/ft_lst.h
+++ b/include/ft_lst.h
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/17 09:58:02 by cacharle #+# #+# */
-/* Updated: 2020/01/17 09:58:45 by cacharle ### ########.fr */
+/* Updated: 2020/01/30 09:55:43 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -32,5 +32,8 @@ t_list *ft_lstmap(t_list *lst, void *(*f)(void *),
void ft_lstpop_front(t_list **lst, void (*del)(void *));
t_list *ft_lstreverse_ret(t_list *lst);
void ft_lstreverse(t_list **lst);
+void ft_lstremove_if(t_list **lst,
+ t_ftbool (*equal)(void *ref, void *content), void *ref,
+ void (*del)(void *content));
#endif
diff --git a/include/ft_types.h b/include/ft_types.h
index 948e33d..b465382 100644
--- a/include/ft_types.h
+++ b/include/ft_types.h
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/17 09:59:15 by cacharle #+# #+# */
-/* Updated: 2020/01/17 10:16:14 by cacharle ### ########.fr */
+/* Updated: 2020/01/30 09:54:28 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,6 +15,7 @@
typedef unsigned char t_ftbyte;
typedef int t_ftbool;
+typedef unsigned int t_ftsize;
typedef char t_ftchar;
typedef unsigned char t_ftuchar;
diff --git a/include/libft_ht.h b/include/libft_ht.h
new file mode 100644
index 0000000..bd67b47
--- /dev/null
+++ b/include/libft_ht.h
@@ -0,0 +1,53 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_ht.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/01/30 08:19:23 by cacharle #+# #+# */
+/* Updated: 2020/01/30 10:34:40 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_HT
+# define FT_HT
+
+# include "libft.h"
+
+typedef struct
+{
+ char *key;
+ void *value;
+} t_ftht_content;
+
+typedef t_list* t_ftht_entry;
+
+typedef struct
+{
+ t_ftsize size;
+ t_ftht_entry *entries;
+} t_ftht;
+
+typedef t_ftuint t_ftht_digest;
+
+
+t_ftht *ft_htnew(t_ftsize size);
+void ft_htdestroy(t_ftht *ht, void (*del)(t_ftht_content*));
+void ft_htdestroy_all(t_ftht *ht);
+void ft_htdestroy_key(t_ftht *ht);
+void ft_htdestroy_value(t_ftht *ht);
+t_ftht_content *ft_htget(t_ftht *ht, char *key);
+t_ftht_content *ft_htset(t_ftht *ht, char *key, void *value);
+void ft_htdelone(t_ftht *ht, char *key, void (*del)(t_ftht_content*));
+void ft_htdelone_key(t_ftht *ht, char *key);
+t_ftht_content *ft_htcontent_new(char *key, void *value);
+
+/*
+** internals
+*/
+
+void ft_inter_htdelcontent_key(t_ftht_content *content);
+t_ftbool ft_inter_htkey_equal(char *ref_key, t_ftht_content *content);
+
+#endif