diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-10-11 15:52:52 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-10-11 15:52:52 +0200 |
| commit | c98de126d2252fe47dc2a9094a5f9a8fa6b4b60a (patch) | |
| tree | 12f1c827ee063ed3e7038f6a704014e611e4f388 /libft/include/libft_dstr.h | |
| parent | a4ceb5974d1b7dcdd12cc81b7eb07893ea16c8ad (diff) | |
| download | minishell-c98de126d2252fe47dc2a9094a5f9a8fa6b4b60a.tar.gz minishell-c98de126d2252fe47dc2a9094a5f9a8fa6b4b60a.tar.bz2 minishell-c98de126d2252fe47dc2a9094a5f9a8fa6b4b60a.zip | |
Removing libft/minishell_test submodules, Removing subject/README/etc
Diffstat (limited to 'libft/include/libft_dstr.h')
| -rw-r--r-- | libft/include/libft_dstr.h | 45 |
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 |
