Adaptive Framework
0.9.0
|
Files | |
file | afw_utf8.h |
AFW String functions. | |
Macros | |
#define | afw_utf8_is_valid(s, len, xctx) |
Determine if series of bytes is valid utf-8. More... | |
#define | afw_utf8_is_nfc(s, len, p, xctx) |
Determine if series of bytes is NFC normalized utf-8. More... | |
#define | afw_utf8_create(s, len, p, xctx) afw_utf8_nfc(s, len, afw_utf8_nfc_option_create, p, xctx) |
Create utf-8 string without copy unless necessary in pool specified. More... | |
#define | afw_utf8_from_utf8_z(s_z, p, xctx) |
Make utf-8 string without copy in specified pool. More... | |
#define | afw_utf8_create_copy(s, len, p, xctx) afw_utf8_nfc(s, len, afw_utf8_nfc_option_create_copy, p, xctx) |
Make a utf-8 sting from chars in pool specified. More... | |
Typedefs | |
typedef const afw_utf8_t *(AFW_CALLBACK * | afw_utf8_from_value_t) (const afw_value_t *value, afw_boolean_t own, afw_xctx_t *xctx) |
Callback function for creating a string from an adaptive value. More... | |
typedef const afw_value_t *(AFW_CALLBACK * | afw_utf8_to_value_t) (const afw_utf8_t *from_utf8, const afw_utf8_t *path, afw_xctx_t *xctx) |
Callback function for converting a string to an adaptive value. More... | |
typedef enum afw_utf8_nfc_option_e | afw_utf8_nfc_option_t |
Enumerations | |
enum | afw_utf8_nfc_option_e { afw_utf8_nfc_option_is_valid , afw_utf8_nfc_option_is_nfc , afw_utf8_nfc_option_create , afw_utf8_nfc_option_create_copy } |
Functions | |
const afw_utf8_t * | afw_utf8_nfc (const afw_utf8_octet_t *s, afw_size_t len, afw_utf8_nfc_option_t option, const afw_pool_t *p, afw_xctx_t *xctx) |
UTF-8 NFC support function. More... | |
afw_code_point_t | afw_utf8_next_code_point (const afw_utf8_octet_t *s, afw_size_t *offset, afw_size_t len, afw_xctx_t *xctx) |
Get next codepoint in utf-8. More... | |
afw_boolean_t | afw_utf8_from_code_point (afw_utf8_octet_t utf8_z[5], afw_code_point_t cp, afw_xctx_t *xctx) |
Convert a code point to utf8. More... | |
const afw_memory_t * | afw_utf8_as_raw (const afw_utf8_t *string, const afw_pool_t *p, afw_xctx_t *xctx) |
Convert utf-8 string to raw in specified pool. More... | |
const afw_utf8_t * | afw_utf8_from_raw (const afw_memory_t *raw, const afw_pool_t *p, afw_xctx_t *xctx) |
Convert raw to a utf-8 NFC normalizing if necessary in specified pool. More... | |
const afw_utf8_t * | afw_utf8_from_encoding (const afw_utf8_t *from_encoding, const char **from, afw_size_t *from_size, const afw_pool_t *p, afw_xctx_t *xctx) |
Convert character encoding to a utf-8 in specified pool. More... | |
const afw_utf8_t *const * | afw_utf8_clone_pointer_array (afw_size_t count, const afw_utf8_t *const *pointers, afw_boolean_t NULL_terminate, const afw_pool_t *p, afw_xctx_t *xctx) |
Clone a pointer array of utf-8 to specified pool. More... | |
const afw_utf8_t * | afw_utf8_array_to_utf8_with_separator (const afw_utf8_t *const *strings, const afw_utf8_t *separator, const afw_pool_t *p, afw_xctx_t *xctx) |
Concat array of utf-8 with optional separator to specified pool. More... | |
const afw_utf8_z_t * | afw_utf8_array_to_utf8_z_with_separator (const afw_utf8_t *const *strings, const afw_utf8_t *separator, const afw_pool_t *p, afw_xctx_t *xctx) |
Concat array of utf-8 with optional separator to specified pool. More... | |
const afw_utf8_z_t * | afw_utf8_z_array_to_utf8_z_with_separator (const afw_utf8_z_t *const *strings_z, const afw_utf8_t *separator, const afw_pool_t *p, afw_xctx_t *xctx) |
Concat array of utf-8 with optional separator to specified pool. More... | |
const afw_utf8_t * | afw_utf8_clone (const afw_utf8_t *string, const afw_pool_t *p, afw_xctx_t *xctx) |
Clone a utf-8 string into a specific pool. More... | |
const afw_utf8_t * | afw_utf8_to_lower (const afw_utf8_t *s, const afw_pool_t *p, afw_xctx_t *xctx) |
Convert utf-8 sting to lower case in specified pool. More... | |
const afw_utf8_t * | afw_utf8_normalize_space (const afw_utf8_t *s, const afw_pool_t *p, afw_xctx_t *xctx) |
Create a utf-8 sting with spaces normalized in specified pool. More... | |
const afw_utf8_t * | afw_utf8_concat (const afw_pool_t *p, afw_xctx_t *xctx,...) |
Concatenate strings with result in specifed pool. More... | |
const afw_utf8_t * | afw_utf8_concat_v (const afw_pool_t *p, afw_xctx_t *xctx, va_list strings) |
Concatenate strings with result in specifed pool. More... | |
afw_boolean_t | afw_utf8_line_column_of_offset (afw_size_t *line_number, afw_size_t *column_number, const afw_utf8_t *s, afw_size_t offset, int tab_size, afw_xctx_t *xctx) |
Determine the line and column of an offset in a string. More... | |
void | afw_utf8_line_count_and_max_column (afw_size_t *number_of_lines, afw_size_t *max_column_number, const afw_utf8_t *s, int tab_size, afw_xctx_t *xctx) |
Determine the line count and maximum column in a string. More... | |
const afw_utf8_t * | afw_utf8_printf (const afw_pool_t *p, afw_xctx_t *xctx, const afw_utf8_z_t *format_z,...) |
Create a utf-8 string using a c format string in specified pool. More... | |
const afw_utf8_t * | afw_utf8_printf_v (const afw_utf8_z_t *format, va_list arg, const afw_pool_t *p, afw_xctx_t *xctx) |
Create a utf-8 string using a c format string in specified pool. More... | |
const afw_utf8_z_t * | afw_utf8_to_utf8_z (const afw_utf8_t *string, const afw_pool_t *p, afw_xctx_t *xctx) |
Convert utf8 to utf8_z in specified pool. More... | |
afw_boolean_t | afw_utf8_starts_with (const afw_utf8_t *string, const afw_utf8_t *starts_with) |
Check to see if a string starts with another string. More... | |
afw_boolean_t | afw_utf8_starts_with_z (const afw_utf8_t *string, const afw_utf8_z_t *starts_with_z) |
Check to see if a string starts with a utf8_z string. More... | |
afw_boolean_t | afw_utf8_ends_with (const afw_utf8_t *string, const afw_utf8_t *ends_with) |
Check to see if a string ends with another string. More... | |
afw_boolean_t | afw_utf8_ends_with_z (const afw_utf8_t *string, const afw_utf8_z_t *ends_with_z) |
Check to see if a string ends with a utf8_z string. More... | |
afw_boolean_t | afw_utf8_equal (const afw_utf8_t *s1, const afw_utf8_t *s2) |
Check to see if a string equals another string. More... | |
afw_boolean_t | afw_utf8_contains (const afw_utf8_t *s1, const afw_utf8_t *s2) |
Check to see if a string contains another string. More... | |
int | afw_utf8_compare (const afw_utf8_t *s1, const afw_utf8_t *s2) |
Compare two strings. More... | |
int | afw_utf8_compare_ignore_case (const afw_utf8_t *s1, const afw_utf8_t *s2, afw_xctx_t *xctx) |
Compare two strings ignoring case. More... | |
afw_boolean_t | afw_utf8_equal_utf8_z (const afw_utf8_t *s1, const afw_utf8_z_t *s2_z) |
Check to see if a string equals a utf8_z string. More... | |
const afw_utf8_t *const * | afw_utf8_parse_csv (const afw_utf8_t *s, const afw_pool_t *p, afw_xctx_t *xctx) |
Check to see if a string equals a utf8_z string. More... | |
void | afw_utf8_substring_byte (afw_utf8_t *result, const afw_utf8_t *string, afw_size_t start, afw_size_t end) |
Set result to a substring of string using byte indexes. More... | |
const afw_utf8_z_t * | afw_utf8_z_create (const afw_utf8_octet_t *s, afw_size_t len, const afw_pool_t *p, afw_xctx_t *xctx) |
Create a NFC Normalized zero terminated UTF-8 string in specified pool. More... | |
afw_boolean_t | afw_utf8_len_starts_with_z (const afw_utf8_octet_t *s1, afw_size_t len1, const afw_utf8_z_t *s2_z) |
Returns true if series of bytes for len s1 starts with zero terminated string s2. More... | |
afw_boolean_t | afw_utf8_z_starts_with_z (const afw_utf8_z_t *s1_z, const afw_utf8_z_t *s2_z) |
Returns true if zero terminated s1 starts with zero terminated string s2. More... | |
int | afw_utf8_z_compare_ignore_case (const afw_utf8_z_t *s1, const afw_utf8_z_t *s2, afw_xctx_t *xctx) |
Compare two zero terminated utf-8 strings ignoring case. | |
afw_boolean_t | afw_utf8_z_equal (const afw_utf8_z_t *s1, const afw_utf8_z_t *s2) |
afw_boolean_t | afw_utf8_z_equal_ignore_case (const afw_utf8_z_t *s1, const afw_utf8_z_t *s2) |
const afw_utf8_z_t * | afw_utf8_z_concat (const afw_pool_t *p, afw_xctx_t *xctx,...) |
const afw_object_t * | afw_utf8_z_query_string_to_object (const afw_utf8_z_t *s, afw_xctx_t *xctx) |
const afw_utf8_z_t * | afw_utf8_z_printf_v (const afw_utf8_z_t *format_z, va_list ap, const afw_pool_t *p, afw_xctx_t *xctx) |
const afw_utf8_z_t * | afw_utf8_z_printf (const afw_pool_t *p, afw_xctx_t *xctx, const afw_utf8_z_t *format_z,...) |
const afw_utf8_z_t * | afw_utf8_z_file_name_from_path (const afw_utf8_z_t *path_z) |
const afw_utf8_z_t * | afw_utf8_z_source_file (const afw_utf8_z_t *source_z) |
Returns value of source_z after last '/ 'or '\'. More... | |
const afw_stream_t * | afw_utf8_stream_create (const afw_utf8_t *streamId, const afw_pool_t *p, afw_xctx_t *xctx) |
Create UTF-8 stream. More... | |
const afw_writer_t * | afw_utf8_writer_create (const afw_utf8_t *tab, const afw_pool_t *p, afw_xctx_t *xctx) |
Create UTF-8 writer. More... | |
void | afw_utf8_stream_get_current_cached_string (const afw_stream_t *stream, afw_utf8_t *current_cached_string, afw_xctx_t *xctx) |
Get the current string in a UTF-8 writer. More... | |
void | afw_utf8_writer_current_string (const afw_writer_t *writer, afw_utf8_t *current_string, afw_xctx_t *xctx) |
Get the current string in a UTF-8 writer. More... | |
All utf8 strings must be valid utf-8.
#define afw_utf8_create | ( | s, | |
len, | |||
p, | |||
xctx | |||
) | afw_utf8_nfc(s, len, afw_utf8_nfc_option_create, p, xctx) |
Create utf-8 string without copy unless necessary in pool specified.
s | pointer to utf-8 characters. |
len | is number of bytes. |
p | pool used for result. |
xctx | of caller. |
This only creates a new afw_string_t struct and sets its values.
The input string will be NFC normalized if it is not already.
Definition at line 239 of file afw_utf8.h.
#define afw_utf8_create_copy | ( | s, | |
len, | |||
p, | |||
xctx | |||
) | afw_utf8_nfc(s, len, afw_utf8_nfc_option_create_copy, p, xctx) |
Make a utf-8 sting from chars in pool specified.
s | pointer to chars. |
len | of chars in bytes or AFW_UTF8_Z_LEN. |
p | pool used for result. |
xctx | of caller. |
The input string must already be valid utf-8. An error is thrown if it is not.
Definition at line 369 of file afw_utf8.h.
#define afw_utf8_from_utf8_z | ( | s_z, | |
p, | |||
xctx | |||
) |
Make utf-8 string without copy in specified pool.
s_z | pointer to zero terminated utf-8 characters. |
len | is number of bytes. |
p | pool used for result. |
xctx | of caller. |
The input string will be NFC normalized if it is not already.
Definition at line 254 of file afw_utf8.h.
#define afw_utf8_is_nfc | ( | s, | |
len, | |||
p, | |||
xctx | |||
) |
Determine if series of bytes is NFC normalized utf-8.
s | pointer to bytes to be tested. |
len | is number of bytes. |
p | used if needed for test. |
xctx | of caller. |
Definition at line 168 of file afw_utf8.h.
#define afw_utf8_is_valid | ( | s, | |
len, | |||
xctx | |||
) |
Determine if series of bytes is valid utf-8.
s | pointer to bytes to be tested. |
len | is number of bytes. |
xctx | of caller. |
Definition at line 154 of file afw_utf8.h.
typedef const afw_utf8_t*(AFW_CALLBACK * afw_utf8_from_value_t) (const afw_value_t *value, afw_boolean_t own, afw_xctx_t *xctx) |
Callback function for creating a string from an adaptive value.
value | |
Indicate | to only include own properties of any objects. |
xctx | of caller. |
Definition at line 39 of file afw_utf8.h.
typedef const afw_value_t*(AFW_CALLBACK * afw_utf8_to_value_t) (const afw_utf8_t *from_utf8, const afw_utf8_t *path, afw_xctx_t *xctx) |
Callback function for converting a string to an adaptive value.
utf-8 | string to convert. |
path | Object path to use if string is an object or NULL. |
object_id | Optional id of object if value is object or NULL. |
xctx | of caller. |
The path parameter is only used if the string being converted is an object entity.
The path must be of the form /<adaptor id>/<object type>/<id>
. This path is parsed to provide return values for the object's afw_object_meta_get_object_id(), afw_object_meta_get_path(), and afw_object_get_object_type() methods.
Definition at line 62 of file afw_utf8.h.
Definition at line 70 of file afw_utf8.h.
const afw_utf8_t* afw_utf8_array_to_utf8_with_separator | ( | const afw_utf8_t *const * | strings, |
const afw_utf8_t * | separator, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Concat array of utf-8 with optional separator to specified pool.
strings | is NULL terminated list of afw_utf8_t pointers. |
separator | or NULL for no separator. |
p | to use. |
xctx | of caller. |
The input strings must already be valid utf-8. An error is thrown if it is not.
Definition at line 906 of file afw_utf8.c.
const afw_utf8_z_t* afw_utf8_array_to_utf8_z_with_separator | ( | const afw_utf8_t *const * | strings, |
const afw_utf8_t * | separator, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Concat array of utf-8 with optional separator to specified pool.
strings | is NULL terminated list of afw_utf8_t pointers. |
separator | or NULL for no separator. |
p | to use. |
xctx | of caller. |
The input strings must already be valid utf-8. An error is thrown if it is not.
Definition at line 951 of file afw_utf8.c.
const afw_memory_t* afw_utf8_as_raw | ( | const afw_utf8_t * | string, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert utf-8 string to raw in specified pool.
string | to convert. |
p | pool used for result. |
xctx | of caller. |
Definition at line 181 of file afw_utf8.h.
const afw_utf8_t* afw_utf8_clone | ( | const afw_utf8_t * | string, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Clone a utf-8 string into a specific pool.
string. | |
len | is number of bytes. |
p | pool used for result. |
xctx | of caller. |
The input string is assumed to already be valid utf-8.
Definition at line 347 of file afw_utf8.h.
const afw_utf8_t* const* afw_utf8_clone_pointer_array | ( | afw_size_t | count, |
const afw_utf8_t *const * | pointers, | ||
afw_boolean_t | NULL_terminate, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Clone a pointer array of utf-8 to specified pool.
count | is number of pointers or -1 if NULL terminated. |
pointers | is list of afw_utf8_t pointers. |
NULL_terminate | indicates resulting array should be NULL terminated. |
p | to use. |
xctx | of caller. |
The input strings must already be valid utf-8. An error is thrown if it is not.
Definition at line 862 of file afw_utf8.c.
int afw_utf8_compare | ( | const afw_utf8_t * | s1, |
const afw_utf8_t * | s2 | ||
) |
Compare two strings.
s1 | first string. |
s2 | second string. |
The input strings are assumed to already be valid utf-8.
int afw_utf8_compare_ignore_case | ( | const afw_utf8_t * | s1, |
const afw_utf8_t * | s2, | ||
afw_xctx_t * | xctx | ||
) |
Compare two strings ignoring case.
s1 | first string. |
s2 | second string. |
The input strings are assumed to already be valid utf-8.
const afw_utf8_t* afw_utf8_concat | ( | const afw_pool_t * | p, |
afw_xctx_t * | xctx, | ||
... | |||
) |
Concatenate strings with result in specifed pool.
p | pool used for result. |
xctx | of caller. |
... | 1 or more valid utf-8 strings followed with NULL. |
const afw_utf8_t* afw_utf8_concat_v | ( | const afw_pool_t * | p, |
afw_xctx_t * | xctx, | ||
va_list | strings | ||
) |
Concatenate strings with result in specifed pool.
p | pool used for result. |
xctx | of caller. |
va_list | 1 or more valid utf-8 strings followed with NULL. |
afw_boolean_t afw_utf8_contains | ( | const afw_utf8_t * | s1, |
const afw_utf8_t * | s2 | ||
) |
Check to see if a string contains another string.
s1 | string. |
s2 | string. |
xctx | of caller. |
The input strings are assumed to already be valid utf-8.
Definition at line 543 of file afw_utf8.c.
afw_boolean_t afw_utf8_ends_with | ( | const afw_utf8_t * | string, |
const afw_utf8_t * | ends_with | ||
) |
Check to see if a string ends with another string.
string | to check. |
ends_with | string. |
xctx | of caller. |
The input strings are assumed to already be valid utf-8.
Definition at line 513 of file afw_utf8.c.
afw_boolean_t afw_utf8_ends_with_z | ( | const afw_utf8_t * | string, |
const afw_utf8_z_t * | ends_with_z | ||
) |
Check to see if a string ends with a utf8_z string.
string | to check. |
ends_with_z | 0 terminated string. |
xctx | of caller. |
The input strings are assumed to already be valid utf-8.
Definition at line 524 of file afw_utf8.c.
afw_boolean_t afw_utf8_equal | ( | const afw_utf8_t * | s1, |
const afw_utf8_t * | s2 | ||
) |
Check to see if a string equals another string.
s1 | string. |
s2 | string. |
xctx | of caller. |
The input strings are assumed to already be valid utf-8.
afw_boolean_t afw_utf8_equal_utf8_z | ( | const afw_utf8_t * | s1, |
const afw_utf8_z_t * | s2_z | ||
) |
Check to see if a string equals a utf8_z string.
s1 | first string. |
s2_z | second 0 terminated string. |
xctx | of caller. |
The input strings are assumed to already be valid utf-8.
afw_boolean_t afw_utf8_from_code_point | ( | afw_utf8_octet_t | utf8_z[5], |
afw_code_point_t | cp, | ||
afw_xctx_t * | xctx | ||
) |
Convert a code point to utf8.
utf8 | an array of 5 bytes to put result followed by a 0 byte. |
cp | to convert. |
xctx | of caller. |
Definition at line 64 of file afw_utf8.c.
const afw_utf8_t* afw_utf8_from_encoding | ( | const afw_utf8_t * | from_encoding, |
const char ** | from, | ||
afw_size_t * | from_size, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert character encoding to a utf-8 in specified pool.
from_encoding | |
from | |
from_size | |
p | pool used for result. |
xctx | of caller. |
The raw memory must represent valid utf-8 or an error is thrown.
Definition at line 395 of file afw_utf8.c.
const afw_utf8_t* afw_utf8_from_raw | ( | const afw_memory_t * | raw, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert raw to a utf-8 NFC normalizing if necessary in specified pool.
raw | value to convert. |
p | pool used for result. |
xctx | of caller. |
The raw memory must represent valid utf-8 or an error is thrown.
Definition at line 199 of file afw_utf8.h.
afw_boolean_t afw_utf8_len_starts_with_z | ( | const afw_utf8_octet_t * | s1, |
afw_size_t | len1, | ||
const afw_utf8_z_t * | s2_z | ||
) |
Returns true if series of bytes for len s1 starts with zero terminated string s2.
s | pointer to utf-8 characters. |
len1 | is number of bytes. |
s2_z | 0 terminated string. |
Definition at line 732 of file afw_utf8.h.
afw_boolean_t afw_utf8_line_column_of_offset | ( | afw_size_t * | line_number, |
afw_size_t * | column_number, | ||
const afw_utf8_t * | s, | ||
afw_size_t | offset, | ||
int | tab_size, | ||
afw_xctx_t * | xctx | ||
) |
Determine the line and column of an offset in a string.
line_number | is return pointer for 1 based line number. |
column_number | is return pointer for 1 based column number. |
s | is string to check. |
offset | is offset within string. |
tab_size | to use for '\t'. |
xctx | of caller. |
If there are no '
', line_number will be set to 1 and column_number will be set to offset adjusted by '\t'.
This function does not validity check the string but should produce the correct column number if the string is valid.
Definition at line 1058 of file afw_utf8.c.
void afw_utf8_line_count_and_max_column | ( | afw_size_t * | number_of_lines, |
afw_size_t * | max_column_number, | ||
const afw_utf8_t * | s, | ||
int | tab_size, | ||
afw_xctx_t * | xctx | ||
) |
Determine the line count and maximum column in a string.
number_of_lines | is return pointer for 1 based max line number. |
max_column_number | is return pointer for 1 based max column number. |
s | is string to check. |
tab_size | to use for '\t'. |
xctx | of caller. |
This function does not validity check the string but should produce the correct column number if the string is valid.
Definition at line 1111 of file afw_utf8.c.
afw_code_point_t afw_utf8_next_code_point | ( | const afw_utf8_octet_t * | s, |
afw_size_t * | offset, | ||
afw_size_t | len, | ||
afw_xctx_t * | xctx | ||
) |
Get next codepoint in utf-8.
s | is pointer to utf-8. |
offset | is address of offset in utf-8 string. Will be incremented. @len of s. |
xctx | of caller. |
The offset incremented past the bytes making up the utf-8 codepoint if the codepoint is valid. If you don't want this behavior, make a copy of offset to a temporary variable and past it to function.
Definition at line 31 of file afw_utf8.c.
const afw_utf8_t* afw_utf8_nfc | ( | const afw_utf8_octet_t * | s, |
afw_size_t | len, | ||
afw_utf8_nfc_option_t | option, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
UTF-8 NFC support function.
s | pointer to utf-8 characters. |
len | is number of bytes. |
option | see afw_utf8_nfc_option_t. |
p | pool used for result. |
xctx | of caller. |
See afw_utf8_nfc_option_t for more information.
This function is designed to do as little work as possible to insure that resulting utf8 string is NFC normalize.
Definition at line 86 of file afw_utf8.c.
const afw_utf8_t* afw_utf8_normalize_space | ( | const afw_utf8_t * | s, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create a utf-8 sting with spaces normalized in specified pool.
s | is valid NFC normalized UTF-8 string. |
p | is pool to use for space normalized string. |
xctx | of caller. |
The input string must already be valid NFC utf-8.
If no normalization is required, the input string is returned.
The whitespace character are hex 20, 09, 0d, and 0a. All leading and trailing whitespace characters are removed and internal sequences of whitespace is replaced by a single hex 20.
const afw_utf8_t* const* afw_utf8_parse_csv | ( | const afw_utf8_t * | s, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Check to see if a string equals a utf8_z string.
s | is string that contains comma separated values. |
p | to use for result. |
xctx | of caller. |
The input strings are assumed to already be valid utf-8.
Definition at line 1149 of file afw_utf8.c.
const afw_utf8_t* afw_utf8_printf | ( | const afw_pool_t * | p, |
afw_xctx_t * | xctx, | ||
const afw_utf8_z_t * | format_z, | ||
... | |||
) |
Create a utf-8 string using a c format string in specified pool.
p | pool used for result. |
xctx | of caller. |
format_z | string. |
... | arguments for format_z. |
Care must be used using this function. No check is made to determine if strings are valid utf-8.
Definition at line 459 of file afw_utf8.c.
const afw_utf8_t* afw_utf8_printf_v | ( | const afw_utf8_z_t * | format, |
va_list | arg, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create a utf-8 string using a c format string in specified pool.
format_z | string. |
arg | arguments for format_z. |
p | pool used for result. |
xctx | of caller. |
Care must be used using this function. No check is made to determine if strings are valid utf-8.
Definition at line 477 of file afw_utf8.c.
afw_boolean_t afw_utf8_starts_with | ( | const afw_utf8_t * | string, |
const afw_utf8_t * | starts_with | ||
) |
Check to see if a string starts with another string.
string | to check. |
starts_with | string. |
xctx | of caller. |
The input strings are assumed to already be valid utf-8.
afw_boolean_t afw_utf8_starts_with_z | ( | const afw_utf8_t * | string, |
const afw_utf8_z_t * | starts_with_z | ||
) |
Check to see if a string starts with a utf8_z string.
string | to check. |
starts_with_z | 0 terminated string. |
xctx | of caller. |
The input strings are assumed to already be valid utf-8.
const afw_stream_t* afw_utf8_stream_create | ( | const afw_utf8_t * | streamId, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create UTF-8 stream.
streamId | |
p | to use. |
xctx | of caller. |
Definition at line 52 of file afw_utf8_stream.c.
void afw_utf8_stream_get_current_cached_string | ( | const afw_stream_t * | stream, |
afw_utf8_t * | current_cached_string, | ||
afw_xctx_t * | xctx | ||
) |
Get the current string in a UTF-8 writer.
writer | |
current | is address of a afw_utf8_t struct that will be updated. |
xctx | of caller. |
Definition at line 78 of file afw_utf8_stream.c.
void afw_utf8_substring_byte | ( | afw_utf8_t * | result, |
const afw_utf8_t * | string, | ||
afw_size_t | start, | ||
afw_size_t | end | ||
) |
Set result to a substring of string using byte indexes.
result | pointer to string to be set. |
string | input. |
start | Inclusive zero based start index of substring. |
end | Exclusive end index of substring. If end is beyond end of string, substring will include all bytes up to end of string. |
If string might contain codepoints > 127, you should use afw_utf8_substring().
Definition at line 694 of file afw_utf8.h.
const afw_utf8_t* afw_utf8_to_lower | ( | const afw_utf8_t * | s, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert utf-8 sting to lower case in specified pool.
s | is valid NFC normalized UTF-8 string. |
p | is pool to use for converted string. |
xctx | of caller. |
The input string must already be valid NFC utf-8.
This conversion is not locale specific.
const afw_utf8_z_t* afw_utf8_to_utf8_z | ( | const afw_utf8_t * | string, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Convert utf8 to utf8_z in specified pool.
string | to convert. |
p | pool used for result. |
xctx | of caller. |
The input strings are assumed to already be valid utf-8.
Definition at line 529 of file afw_utf8.h.
const afw_writer_t* afw_utf8_writer_create | ( | const afw_utf8_t * | tab, |
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create UTF-8 writer.
tab | string to use or NULL if no whitespace is to be added. |
p | to use. |
xctx | of caller. |
Definition at line 52 of file afw_utf8_writer.c.
void afw_utf8_writer_current_string | ( | const afw_writer_t * | writer, |
afw_utf8_t * | current_string, | ||
afw_xctx_t * | xctx | ||
) |
Get the current string in a UTF-8 writer.
writer | |
current | is address of a afw_utf8_t struct that will be updated. |
xctx | of caller. |
Definition at line 78 of file afw_utf8_writer.c.
const afw_utf8_z_t* afw_utf8_z_array_to_utf8_z_with_separator | ( | const afw_utf8_z_t *const * | strings_z, |
const afw_utf8_t * | separator, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Concat array of utf-8 with optional separator to specified pool.
strings_z | is NULL terminated list of afw_utf8_z_t pointers. |
separator | or NULL for no separator. |
p | to use. |
xctx | of caller. |
The input strings must already be valid utf-8. An error is thrown if it is not.
Definition at line 994 of file afw_utf8.c.
const afw_utf8_z_t* afw_utf8_z_concat | ( | const afw_pool_t * | p, |
afw_xctx_t * | xctx, | ||
... | |||
) |
Concatenate zero terminated UTF8 strings in specifed pool.
const afw_utf8_z_t* afw_utf8_z_create | ( | const afw_utf8_octet_t * | s, |
afw_size_t | len, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create a NFC Normalized zero terminated UTF-8 string in specified pool.
s | pointer to utf-8 characters. |
len | is number of bytes. |
p | pool used for result. |
xctx | of caller. |
A copy is always required to add a 0 byte.
An error is thrown if s is not valid utf-8.
Definition at line 366 of file afw_utf8.c.
afw_boolean_t afw_utf8_z_equal | ( | const afw_utf8_z_t * | s1, |
const afw_utf8_z_t * | s2 | ||
) |
Compare two zero terminated UTF8 strings to be equal. Strings should already be normalized (NFC, etc.)
Definition at line 799 of file afw_utf8.h.
afw_boolean_t afw_utf8_z_equal_ignore_case | ( | const afw_utf8_z_t * | s1, |
const afw_utf8_z_t * | s2 | ||
) |
Compare two zero terminated UTF8 strings to be equal. Strings should already be normalized (NFC, etc.)
Definition at line 817 of file afw_utf8.h.
const afw_utf8_z_t* afw_utf8_z_file_name_from_path | ( | const afw_utf8_z_t * | path_z | ) |
Returns pointer in path_z past last / or .
Definition at line 873 of file afw_utf8.h.
const afw_utf8_z_t* afw_utf8_z_printf | ( | const afw_pool_t * | p, |
afw_xctx_t * | xctx, | ||
const afw_utf8_z_t * | format_z, | ||
... | |||
) |
Create a utf8_z string using a c format string in specified pool.
Definition at line 854 of file afw_utf8.h.
const afw_utf8_z_t* afw_utf8_z_printf_v | ( | const afw_utf8_z_t * | format_z, |
va_list | ap, | ||
const afw_pool_t * | p, | ||
afw_xctx_t * | xctx | ||
) |
Create a utf8_z string using a c format string and va_list in specified pool.
Definition at line 844 of file afw_utf8.c.
const afw_object_t* afw_utf8_z_query_string_to_object | ( | const afw_utf8_z_t * | s, |
afw_xctx_t * | xctx | ||
) |
Query string to object.
const afw_utf8_z_t* afw_utf8_z_source_file | ( | const afw_utf8_z_t * | source_z | ) |
Returns value of source_z after last '/ 'or '\'.
source_z |
This function is intended to return the pointer into a passed FILE that is past the last '/' or '\' for compilers that provide the full path.
Definition at line 1037 of file afw_utf8.c.
afw_boolean_t afw_utf8_z_starts_with_z | ( | const afw_utf8_z_t * | s1_z, |
const afw_utf8_z_t * | s2_z | ||
) |
Returns true if zero terminated s1 starts with zero terminated string s2.
s | pointer to utf-8 characters. |
s1_z | 0 terminated string. |
s2_z | 0 terminated string. |
Definition at line 756 of file afw_utf8.h.