aboutsummaryrefslogtreecommitdiff
path: root/libft/include/libft_dstr.h
diff options
context:
space:
mode:
Diffstat (limited to 'libft/include/libft_dstr.h')
-rw-r--r--libft/include/libft_dstr.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/libft/include/libft_dstr.h b/libft/include/libft_dstr.h
new file mode 100644
index 0000000..d482f73
--- /dev/null
+++ b/libft/include/libft_dstr.h
@@ -0,0 +1,45 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* libft_dstr.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/04/03 10:39:51 by charles #+# #+# */
+/* Updated: 2020/06/09 17:35:47 by charles ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef LIBFT_DSTR_H
+# define LIBFT_DSTR_H
+
+# include <stdlib.h>
+# include "libft_def.h"
+# include "libft_str.h"
+# include "libft_mem.h"
+
+/*
+** \brief Dynamic string struct
+** \param str Underlying null-terminated character array
+** \param length Number of character (not including the '\0')
+** \param capacity Maximum length - 1 of the current string
+*/
+
+typedef struct s_ftdstr
+{
+ char *str;
+ size_t length;
+ size_t capacity;
+} t_ftdstr;
+
+t_ftdstr *ft_dstrnew(char *from);
+void ft_dstrdestroy(t_ftdstr *dstr);
+t_ftdstr *ft_dstrgrow(t_ftdstr *dstr, size_t at_least);
+t_ftdstr *ft_dstrwrap(char *str);
+char *ft_dstrunwrap(t_ftdstr *dstr);
+t_ftdstr *ft_dstrinsert(t_ftdstr *dstr, char *inserted, size_t i);
+void ft_dstrerase(t_ftdstr *dstr, size_t start, size_t len);
+t_ftdstr *ft_dstrsubstitute(t_ftdstr *dstr, char *replacement,
+ size_t start, size_t end);
+
+#endif