Libft
Custom implementation of core libc functions with additional utility helpers.
Loading...
Searching...
No Matches
buff_format.h
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* buff_format.h :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: gastesan <gastesan@student.42.fr> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2026/01/10 22:44:44 by gastesan #+# #+# */
9/* Updated: 2026/06/28 14:15:22 by gastesan ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#ifndef BUFF_FORMAT_H
14# define BUFF_FORMAT_H
15
16# include "libft.h"
17
56
63void rules_parse(t_rules *rules, const char **const fstring);
64
72bool rules_apply(t_buff *buff, t_rules *rules);
73
82bool append(t_buff *buff, t_rules *rules, va_list *args);
83
91bool append_char(t_buff *buff, char c);
92
100bool append_int(t_buff *buff, int nb);
101
109bool append_uint(t_buff *buff, unsigned int nb);
110
119bool append_hex(t_buff *buff, unsigned long nb, bool uppercase);
120
128bool append_ptr(t_buff *buff, unsigned long nb);
129
130#endif
bool append_ptr(t_buff *buff, unsigned long nb)
Appends a pointer address to the buffer.
Definition append_2.c:65
bool append_uint(t_buff *buff, unsigned int nb)
Appends an unsigned integer to the buffer as a string.
Definition append_2.c:34
void rules_parse(t_rules *rules, const char **const fstring)
Parses format specifiers from a format string.
Definition rules_parse.c:105
bool rules_apply(t_buff *buff, t_rules *rules)
Applies formatting rules to a buffer.
Definition rules_apply.c:138
bool append_char(t_buff *buff, char c)
Appends a character to the buffer.
Definition append_2.c:16
bool append_int(t_buff *buff, int nb)
Appends an integer to the buffer as a string.
Definition append_2.c:21
bool append_hex(t_buff *buff, unsigned long nb, bool uppercase)
Appends a number in hexadecimal format to the buffer.
Definition append_2.c:47
bool append(t_buff *buff, t_rules *rules, va_list *args)
Appends formatted argument to buffer based on rules.
Definition append_1.c:20
struct s_rules t_rules
Dynamic buffer structure for efficient string/data manipulation.
Definition libft.h:54
Structure holding format specifier rules for printf-like formatting.
Definition buff_format.h:34
bool space
Display space before positive numbers.
Definition buff_format.h:38
bool zero_padding
Pad with zeros instead of spaces.
Definition buff_format.h:42
bool hex_prefix
Display '0x' or '0X' prefix for hex numbers.
Definition buff_format.h:40
bool plus
Display '+' sign for positive numbers.
Definition buff_format.h:36
bool width_enabled
Width specifier is enabled.
Definition buff_format.h:48
char conversion
Conversion specifier character.
Definition buff_format.h:52
bool right_padding
Right-align the output.
Definition buff_format.h:44
int precision
Precision value, -1 if not set.
Definition buff_format.h:46
int width
Minimum field width.
Definition buff_format.h:50
bool is_zero
Value is zero (used for special cases).
Definition buff_format.h:54