Specifier API¶
Overview¶
Helper functions for accessing specifiers from other languages More…
// typedefs typedef enum fmt_flag fmt_flag; // enums enum fmt_flag; // global functions fmt_spec* fmt_spec_alloc(void); void fmt_spec_free(fmt_spec* spec); char** fmt_str_alloc(fmt_char* str); void fmt_str_free(fmt_char** str_ptr); int32_t fmt_spec_get_start_position(fmt_spec* spec, fmt_char** str); int32_t fmt_spec_get_end_position(fmt_spec* spec, fmt_char** str); uint32_t fmt_spec_get_kind(fmt_spec* spec); uint32_t fmt_spec_get_parameter(fmt_spec* spec); uint32_t fmt_spec_get_width(fmt_spec* spec); uint32_t fmt_spec_get_precision(fmt_spec* spec); uint32_t fmt_spec_get_length(fmt_spec* spec); uint32_t fmt_spec_get_type(fmt_spec* spec); fmt_bool fmt_spec_get_flag(fmt_spec* spec, fmt_flag flag);
Detailed Documentation¶
Helper functions for accessing specifiers from other languages
Global Functions¶
fmt_spec* fmt_spec_alloc(void)
Allocate specifier and initialize it
Returns:
Newly allocated format specifier
void fmt_spec_free(fmt_spec* spec)
Free allocated specifier
Parameters:
spec |
Pointer to the specifier |
char** fmt_str_alloc(fmt_char* str)
Allocate string buffer for use in fmt_parser
API
Parameters:
str |
The string |
Returns:
Newly allocated pointer to string
void fmt_str_free(fmt_char** str_ptr)
Free string pointer allocated by fmt_str_alloc()
Parameters:
str_ptr |
The string pointer |
int32_t fmt_spec_get_start_position(fmt_spec* spec, fmt_char** str)
Get specifier’s start position
Parameters:
spec |
The specifier |
str |
Original string that was originally passed to the first |
Returns:
Position within str
string
int32_t fmt_spec_get_end_position(fmt_spec* spec, fmt_char** str)
Get specifier’s end position
Parameters:
spec |
The specifier |
str |
Original string that was originally passed to the first |
Returns:
End position within str
string
uint32_t fmt_spec_get_kind(fmt_spec* spec)
Get kind of a specifier
Parameters:
spec |
The specifier |
Returns:
Value belonging to fmt_spec_kind
enumeration
uint32_t fmt_spec_get_parameter(fmt_spec* spec)
Get parameter of a specifier
Parameters:
spec |
Returns:
Parameter value
uint32_t fmt_spec_get_width(fmt_spec* spec)
Get width of a specifier
Parameters:
spec |
Returns:
Width value
uint32_t fmt_spec_get_precision(fmt_spec* spec)
Get precision of a specifier
Parameters:
spec |
Returns:
Precision value
uint32_t fmt_spec_get_length(fmt_spec* spec)
Get length modifier of a specifier
Parameters:
spec |
Returns:
Length modifier
uint32_t fmt_spec_get_type(fmt_spec* spec)
Get type of a specifier
Parameters:
spec |
The specifier |
Returns:
Actual type in terms of fmt_spec_type
enumeration
fmt_bool fmt_spec_get_flag(fmt_spec* spec, fmt_flag flag)
Get flag of a specifier
Parameters:
spec |
The specifier |
flag |
The flag of |
Returns:
FMT_TRUE
if flag is set, FMT_FALSE
otherwise