This module implements parsing and formating of strings and integers.
More...
#include <stdint.h>
#include <stdbool.h>
Go to the source code of this file.
|
struct | CnvParams |
| This structure provides information about formatting and parsing. More...
|
|
|
int | cnvParseI (const char *input, int32_t *output, CnvParams params) |
| Parse a signed integer. More...
|
|
int | cnvParseU (const char *input, uint32_t *output, CnvParams params) |
| Parse an unsigned integer. More...
|
|
int | cnvFormatI (int32_t input, char *output, CnvParams params) |
| Formats a signed integer into a character buffer. More...
|
|
int | cnvFormatU (int32_t input, char *output, CnvParams params) |
| Formats an unsigned integer into a character buffer. More...
|
|
void | cnvFill (const char *input, char *output, CnvParams params) |
| Pads a string into a bigger buffer either prepending or postpending a padding character. More...
|
|
This module implements parsing and formating of strings and integers.
Definition in file convert.h.
Value:{ \
.base = 10, \
.len = 0, \
.fill = ' ', \
.uppercase = false, \
.alignleft = false \
}
Default conversion/formatting parameters (base 10).
Definition at line 47 of file convert.h.
Value:{ \
.base = 16, \
.len = 0, \
.fill = '0', \
.uppercase = false, \
.alignleft = false \
}
Definition at line 56 of file convert.h.
void cnvFill |
( |
const char * |
input, |
|
|
char * |
output, |
|
|
CnvParams |
params |
|
) |
| |
Pads a string into a bigger buffer either prepending or postpending a padding character.
- Parameters
-
input | The input string to pad |
output | The output buffer in which the padding is done |
params | The conversion parameters. |
Definition at line 179 of file convert.c.
int cnvFormatI |
( |
int32_t |
input, |
|
|
char * |
output, |
|
|
CnvParams |
params |
|
) |
| |
Formats a signed integer into a character buffer.
- Parameters
-
input | The value to format |
output | The output buffer to write into |
params | The conversino parameters |
- Returns
- The number of characters formatted
Definition at line 160 of file convert.c.
int cnvFormatU |
( |
int32_t |
input, |
|
|
char * |
output, |
|
|
CnvParams |
params |
|
) |
| |
Formats an unsigned integer into a character buffer.
- Parameters
-
input | The value to format |
output | The output buffer to write into |
params | The conversion parameters |
- Returns
- The number of characters formatted
Definition at line 137 of file convert.c.
int cnvParseI |
( |
const char * |
input, |
|
|
int32_t * |
output, |
|
|
CnvParams |
params |
|
) |
| |
Parse a signed integer.
- Parameters
-
input | The input buffer |
output | A pointer to the variable to write the parsed value into. |
params | The conversion parameters |
- Returns
- The number of characters processed.
Definition at line 90 of file convert.c.
int cnvParseU |
( |
const char * |
input, |
|
|
uint32_t * |
output, |
|
|
CnvParams |
params |
|
) |
| |
Parse an unsigned integer.
- Parameters
-
input | The input buffer |
output | A pointer to the variable to write the parsed value into. |
params | The conversion parameters |
- Returns
- The number of characters processed.
Definition at line 61 of file convert.c.