-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_format_type.h
65 lines (55 loc) · 2.19 KB
/
ft_format_type.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
62
63
64
65
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_format_type.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fgalaup <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/11/06 08:58:08 by fgalaup #+# #+# */
/* Updated: 2021/03/05 12:19:56 by fgalaup ### ########lyon.fr */
/* */
/* ************************************************************************** */
#ifndef FT_FORMAT_TYPE_H
# define FT_FORMAT_TYPE_H
# include "ft_format.h"
# include <stdarg.h>
typedef t_bytes_array t_ba;
typedef void (*t_converter)(va_list args, t_list *flags, t_ba *seg);
typedef void* (*t_flags_parser)(char **start, t_list **flags);
typedef struct s_format_arg
{
t_bytes_array *converted;
size_t parsed_size;
} t_format_arg;
/*
** Type Name: t_format_converter
** Description : This structure type store one type converter
** Vars :
** - (Caracter) indicator : The converion indicator
** - (Function)[char *(*f)(void *)] ft_converter :
** Function to convert an type to a string
*/
typedef struct s_format_converter
{
char *indicator;
t_converter ft_converter;
} t_format_converter;
/*
** Type Name: t_format_flag
** Description : This structure type store one flag to formating the format
** Vars :
** - (String) flag : The flags (id) example : '#', '-' ...
** Is also used for parsing
** - (Function)[void *(*f(char **)] ft_flags_parser :
** This fonction contain the flag parmams parser
** - (Function)[char *(*f)(char *)] ft_formater :
** This function format the converter args
*/
typedef struct s_format_flag
{
char *flag;
t_flags_parser ft_flags_parser;
} t_format_flag;
t_format_flag *ft_modular_flags(void);
t_format_converter *ft_modular_converter(void);
#endif