Chromium Embedded Framework (CEF)
127.1.0+ga1ec504+chromium-127.0.6533.57
|
CEF provides functions for converting between UTF-8, -16 and -32 strings. More...
Classes | |
struct | cef_string_wide_t |
CEF string type definitions. More... | |
struct | cef_string_utf8_t |
struct | cef_string_utf16_t |
Macros | |
#define | cef_string_wide_copy(src, src_len, output) cef_string_wide_set(src, src_len, output, true) |
Convenience macros for copying values. More... | |
#define | cef_string_utf8_copy(src, src_len, output) cef_string_utf8_set(src, src_len, output, true) |
#define | cef_string_utf16_copy(src, src_len, output) cef_string_utf16_set(src, src_len, output, true) |
Typedefs | |
typedef cef_string_wide_t * | cef_string_userfree_wide_t |
It is sometimes necessary for the system to allocate string structures with the expectation that the user will free them. More... | |
typedef cef_string_utf8_t * | cef_string_userfree_utf8_t |
typedef cef_string_utf16_t * | cef_string_userfree_utf16_t |
Functions | |
CEF_EXPORT int | cef_string_wide_set (const wchar_t *src, size_t src_len, cef_string_wide_t *output, int copy) |
These functions set string values. More... | |
CEF_EXPORT int | cef_string_utf8_set (const char *src, size_t src_len, cef_string_utf8_t *output, int copy) |
CEF_EXPORT int | cef_string_utf16_set (const char16_t *src, size_t src_len, cef_string_utf16_t *output, int copy) |
CEF_EXPORT void | cef_string_wide_clear (cef_string_wide_t *str) |
These functions clear string values. More... | |
CEF_EXPORT void | cef_string_utf8_clear (cef_string_utf8_t *str) |
CEF_EXPORT void | cef_string_utf16_clear (cef_string_utf16_t *str) |
CEF_EXPORT int | cef_string_wide_cmp (const cef_string_wide_t *str1, const cef_string_wide_t *str2) |
These functions compare two string values with the same results as strcmp(). More... | |
CEF_EXPORT int | cef_string_utf8_cmp (const cef_string_utf8_t *str1, const cef_string_utf8_t *str2) |
CEF_EXPORT int | cef_string_utf16_cmp (const cef_string_utf16_t *str1, const cef_string_utf16_t *str2) |
CEF_EXPORT int | cef_string_wide_to_utf8 (const wchar_t *src, size_t src_len, cef_string_utf8_t *output) |
These functions convert between UTF-8, -16, and -32 strings. More... | |
CEF_EXPORT int | cef_string_utf8_to_wide (const char *src, size_t src_len, cef_string_wide_t *output) |
CEF_EXPORT int | cef_string_wide_to_utf16 (const wchar_t *src, size_t src_len, cef_string_utf16_t *output) |
CEF_EXPORT int | cef_string_utf16_to_wide (const char16_t *src, size_t src_len, cef_string_wide_t *output) |
CEF_EXPORT int | cef_string_utf8_to_utf16 (const char *src, size_t src_len, cef_string_utf16_t *output) |
CEF_EXPORT int | cef_string_utf16_to_utf8 (const char16_t *src, size_t src_len, cef_string_utf8_t *output) |
CEF_EXPORT int | cef_string_ascii_to_wide (const char *src, size_t src_len, cef_string_wide_t *output) |
These functions convert an ASCII string, typically a hardcoded constant, to a Wide/UTF16 string. More... | |
CEF_EXPORT int | cef_string_ascii_to_utf16 (const char *src, size_t src_len, cef_string_utf16_t *output) |
CEF_EXPORT cef_string_userfree_wide_t | cef_string_userfree_wide_alloc (void) |
These functions allocate a new string structure. More... | |
CEF_EXPORT cef_string_userfree_utf8_t | cef_string_userfree_utf8_alloc (void) |
CEF_EXPORT cef_string_userfree_utf16_t | cef_string_userfree_utf16_alloc (void) |
CEF_EXPORT void | cef_string_userfree_wide_free (cef_string_userfree_wide_t str) |
These functions free the string structure allocated by the associated alloc function. More... | |
CEF_EXPORT void | cef_string_userfree_utf8_free (cef_string_userfree_utf8_t str) |
CEF_EXPORT void | cef_string_userfree_utf16_free (cef_string_userfree_utf16_t str) |
CEF_EXPORT int | cef_string_utf16_to_lower (const char16_t *src, size_t src_len, cef_string_utf16_t *output) |
These functions convert utf16 string case using the current ICU locale. More... | |
CEF_EXPORT int | cef_string_utf16_to_upper (const char16_t *src, size_t src_len, cef_string_utf16_t *output) |
CEF provides functions for converting between UTF-8, -16 and -32 strings.
CEF string types are safe for reading from multiple threads but not for modification. It is the user's responsibility to provide synchronization if modifying CEF strings from multiple threads.
#define cef_string_utf16_copy | ( | src, | |
src_len, | |||
output | |||
) | cef_string_utf16_set(src, src_len, output, true) |
#define cef_string_utf8_copy | ( | src, | |
src_len, | |||
output | |||
) | cef_string_utf8_set(src, src_len, output, true) |
#define cef_string_wide_copy | ( | src, | |
src_len, | |||
output | |||
) | cef_string_wide_set(src, src_len, output, true) |
Convenience macros for copying values.
It is sometimes necessary for the system to allocate string structures with the expectation that the user will free them.
The userfree types act as a hint that the user is responsible for freeing the structure.
CEF_EXPORT int cef_string_ascii_to_utf16 | ( | const char * | src, |
size_t | src_len, | ||
cef_string_utf16_t * | output | ||
) |
CEF_EXPORT int cef_string_ascii_to_wide | ( | const char * | src, |
size_t | src_len, | ||
cef_string_wide_t * | output | ||
) |
These functions convert an ASCII string, typically a hardcoded constant, to a Wide/UTF16 string.
Use instead of the UTF8 conversion routines if you know the string is ASCII.
CEF_EXPORT cef_string_userfree_utf16_t cef_string_userfree_utf16_alloc | ( | void | ) |
CEF_EXPORT void cef_string_userfree_utf16_free | ( | cef_string_userfree_utf16_t | str | ) |
CEF_EXPORT cef_string_userfree_utf8_t cef_string_userfree_utf8_alloc | ( | void | ) |
CEF_EXPORT void cef_string_userfree_utf8_free | ( | cef_string_userfree_utf8_t | str | ) |
CEF_EXPORT cef_string_userfree_wide_t cef_string_userfree_wide_alloc | ( | void | ) |
These functions allocate a new string structure.
They must be freed by calling the associated free function.
CEF_EXPORT void cef_string_userfree_wide_free | ( | cef_string_userfree_wide_t | str | ) |
These functions free the string structure allocated by the associated alloc function.
Any string contents will first be cleared.
CEF_EXPORT void cef_string_utf16_clear | ( | cef_string_utf16_t * | str | ) |
CEF_EXPORT int cef_string_utf16_cmp | ( | const cef_string_utf16_t * | str1, |
const cef_string_utf16_t * | str2 | ||
) |
CEF_EXPORT int cef_string_utf16_set | ( | const char16_t * | src, |
size_t | src_len, | ||
cef_string_utf16_t * | output, | ||
int | copy | ||
) |
CEF_EXPORT int cef_string_utf16_to_lower | ( | const char16_t * | src, |
size_t | src_len, | ||
cef_string_utf16_t * | output | ||
) |
These functions convert utf16 string case using the current ICU locale.
This may change the length of the string in some cases.
CEF_EXPORT int cef_string_utf16_to_upper | ( | const char16_t * | src, |
size_t | src_len, | ||
cef_string_utf16_t * | output | ||
) |
CEF_EXPORT int cef_string_utf16_to_utf8 | ( | const char16_t * | src, |
size_t | src_len, | ||
cef_string_utf8_t * | output | ||
) |
CEF_EXPORT int cef_string_utf16_to_wide | ( | const char16_t * | src, |
size_t | src_len, | ||
cef_string_wide_t * | output | ||
) |
CEF_EXPORT void cef_string_utf8_clear | ( | cef_string_utf8_t * | str | ) |
CEF_EXPORT int cef_string_utf8_cmp | ( | const cef_string_utf8_t * | str1, |
const cef_string_utf8_t * | str2 | ||
) |
CEF_EXPORT int cef_string_utf8_set | ( | const char * | src, |
size_t | src_len, | ||
cef_string_utf8_t * | output, | ||
int | copy | ||
) |
CEF_EXPORT int cef_string_utf8_to_utf16 | ( | const char * | src, |
size_t | src_len, | ||
cef_string_utf16_t * | output | ||
) |
CEF_EXPORT int cef_string_utf8_to_wide | ( | const char * | src, |
size_t | src_len, | ||
cef_string_wide_t * | output | ||
) |
CEF_EXPORT void cef_string_wide_clear | ( | cef_string_wide_t * | str | ) |
These functions clear string values.
The structure itself is not freed.
CEF_EXPORT int cef_string_wide_cmp | ( | const cef_string_wide_t * | str1, |
const cef_string_wide_t * | str2 | ||
) |
These functions compare two string values with the same results as strcmp().
CEF_EXPORT int cef_string_wide_set | ( | const wchar_t * | src, |
size_t | src_len, | ||
cef_string_wide_t * | output, | ||
int | copy | ||
) |
These functions set string values.
If |copy| is true (1) the value will be copied instead of referenced. It is up to the user to properly manage the lifespan of references.
CEF_EXPORT int cef_string_wide_to_utf16 | ( | const wchar_t * | src, |
size_t | src_len, | ||
cef_string_utf16_t * | output | ||
) |
CEF_EXPORT int cef_string_wide_to_utf8 | ( | const wchar_t * | src, |
size_t | src_len, | ||
cef_string_utf8_t * | output | ||
) |
These functions convert between UTF-8, -16, and -32 strings.
They are potentially slow so unnecessary conversions should be avoided. The best possible result will always be written to |output| with the boolean return value indicating whether the conversion is 100% valid.