aboutsummaryrefslogtreecommitdiff
path: root/include/libft_dstr.h
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-05-09 12:31:50 +0200
committerCharles <sircharlesaze@gmail.com>2020-05-09 12:31:50 +0200
commit02abc030a68cb2fdd2f21c96db830ec8cb9176ad (patch)
tree0c2d67c94a3618639fc2cd29d8bc78820e41c254 /include/libft_dstr.h
parentb5124347359833fcde33452978c62133879c6c9e (diff)
parent3a2d19df9e509d0b015c786eb02f8315ff0ad91c (diff)
downloadlibft-02abc030a68cb2fdd2f21c96db830ec8cb9176ad.tar.gz
libft-02abc030a68cb2fdd2f21c96db830ec8cb9176ad.tar.bz2
libft-02abc030a68cb2fdd2f21c96db830ec8cb9176ad.zip
Merge remote-tracking branch 'origin/minishell'
Diffstat (limited to 'include/libft_dstr.h')
-rw-r--r--include/libft_dstr.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/include/libft_dstr.h b/include/libft_dstr.h
new file mode 100644
index 0000000..732e475
--- /dev/null
+++ b/include/libft_dstr.h
@@ -0,0 +1,44 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* libft_dstr.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/04/03 10:39:51 by charles #+# #+# */
+/* Updated: 2020/04/05 00:37:05 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);
+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