#include "bt_utilities_internal.h"
#include "bt_types.h"
#include <stdlib.h>
Functions | |
BT_Char32 * | bt_lcscat (BT_Char32 *s1, const BT_Char32 *s2) |
UTF-32 version of strcat(). | |
int | bt_lcscmp (const BT_Char32 *s1, const BT_Char32 *s2) |
UTF-32 version of strcmp(). | |
BT_Char32 * | bt_lcscpy (BT_Char32 *s1, const BT_Char32 *s2) |
UTF-32 version of strcpy(). | |
size_t | bt_lcslen (const BT_Char32 *s) |
UTF-32 version of strlen(). | |
int | bt_lcsncmp (const BT_Char32 *s1, const BT_Char32 *s2, size_t n) |
UTF-32 version of strncmp(). | |
BT_Char32 * | bt_lcsncpy (BT_Char32 *s1, const BT_Char32 *s2, size_t n) |
UTF-32 version of strncpy(). | |
char * | bt_xutf16toutf8 (char *outbuf, const BT_Char16 *inbuf, const size_t outbuf_size) |
Convert 0-terminated UTF-16 string to NUL-terminated UTF-8 string. | |
size_t | bt_xutf16toutf8_lengths (char *outbuf, size_t outbuf_size, const BT_Char16 *inbuf, size_t inbuf_size, bool *truncated) |
Convert UTF-16 in a buffer into a UTF-8 buffer. | |
BT_Char16 * | bt_xutf8toutf16 (BT_Char16 *outbuf, const char *inbuf, const size_t outbuf_size) |
Convert UTF-8 to UTF-16. | |
BT_Char16 * | bt_xutf8toutf16n (BT_Char16 *outbuf, const size_t outbuf_size, const char *inbuf, const size_t inbuf_size) |
Convert non-NUL terminated UTF-8 to 0-terminated UTF-16. | |
BT_Char16 * | bt_xwcscat (BT_Char16 *s1, const BT_Char16 *s2) |
UTF-16 version of strcat(). | |
int | bt_xwcscmp (const BT_Char16 *s1, const BT_Char16 *s2) |
UTF-16 version of strcmp(). | |
BT_Char16 * | bt_xwcscpy (BT_Char16 *s1, const BT_Char16 *s2) |
UTF-16 version of strcpy(). | |
size_t | bt_xwcslen (const BT_Char16 *s1) |
UTF-16 version of strlen(). | |
int | bt_xwcsncmp (const BT_Char16 *s1, const BT_Char16 *s2, size_t n) |
UTF-16 version of strncmp(). | |
BT_Char16 * | bt_xwcsncpy (BT_Char16 *s1, const BT_Char16 *s2, size_t n) |
UTF-16 version of strncpy(). | |
long | bt_xwcstol (const BT_Char16 *nptr, BT_Char16 **endptr, int base) |
UTF-16 version of strtol(). | |
unsigned long | bt_xwcstoul (const BT_Char16 *nptr, BT_Char16 **endptr, int base) |
UTF-16 version of strtoul(). |
32-bit character (UTF-32) version of strcat().
32-bit character (UTF-32) version of strcmp().
32-bit character (UTF-32) version of strcpy().
size_t bt_lcslen | ( | const BT_Char32 * | s | ) |
32-bit character (UTF-32) version of strlen().
32-bit character (UTF-32) version of strncmp().
32-bit character (UTF-32) version of strncpy().
char* bt_xutf16toutf8 | ( | char * | outbuf, | |
const BT_Char16 * | inbuf, | |||
const size_t | outbuf_size | |||
) |
Unlike bt_xutf8toutf16n, this function interprets 0 as a string terminator, and add the terminating NUL byte at the end of the converted UTF-8 string. When there is not enough space in the output buffer, the terminating NUL will be placed just after the end of the last UTF-8 character that does fit within outbuf_size-1 bytes, which may not be the (outbuf_size-1)'th element.
outbuf | Output buffer. | |
inbuf | Input string, terminated with 0. | |
outbuf_size | Size (the number of elements) of the output buffer. This should be at least 1. |
size_t bt_xutf16toutf8_lengths | ( | char * | outbuf, | |
size_t | outbuf_size, | |||
const BT_Char16 * | inbuf, | |||
size_t | inbuf_size, | |||
bool * | truncated | |||
) |
The input and output buffers are specified by the address and the length. The string may contain 0 but it will not be interepreted as a terminator. It will be converted to 0 and the conversion will continue to the next character. The truncation status will be stored in a boolean flag. This uses implemented using bt_ConvertUTF16toUTF8, and only the truncation is reported. Other error status will be silently ignored. Use of bt_ConvertUTF16toUTF8 is recommended to detect other error status.
outbuf | Output buffer. | |
outbuf_size | Size (the number of elements) of the output buffer. | |
inbuf | Input string (not terminated with 0). | |
inbuf_size | The number of characters at inbuf to be converted. | |
truncated | Pointer to a bool variable, which will be set true if and only if all characters in the input buffer have not been converted. |
This function converts the UTF-8 string pointed to by inbuf to UTF-16 string and stores the result into the buffer starting at outbuf for up to outbuf_size elements.
This function silently truncates the string if there is not enough space in the output buffer. Use bt_ConvertUTF16toUTF8 in order to detect truncation and other error status.
outbuf | Pointer to the output buffer. | |
inbuf | Pointer to the NUL-terminated string. | |
outbuf_size | Size (the number of elements) of output buffer. This should be at least 1 to secure the place to put the terminating 0. |
BT_Char16* bt_xutf8toutf16n | ( | BT_Char16 * | outbuf, | |
const size_t | outbuf_size, | |||
const char * | inbuf, | |||
const size_t | inbuf_size | |||
) |
This function converts the UTF-8 string of up to inbuf_size bytes pointed to by inbuf to UTF-16 string and stores the result into the buffer starting at outbuf for up to outbuf_size elements. The NUL byte in the input does not terminates the string. On outputing, however, the function does place the terminating BT_Char16 of value 0. So, at most n-1 characters can be converted. This function silently truncates the string if there is not enough space in the output buffer. Use bt_ConvertUTF8toUTF16 in order to detect truncation and other error status.
outbuf | Pointer to the output buffer. | |
outbuf_size | Size (the number of elements) of the output buffer. This should be at least 1. | |
inbuf | Pointer to the input buffer. | |
inbuf_size | Size (the number of elements) of the input buffer. |
16-bit character (UTF-16) version of strcat().
16-bit character (UTF-16) version of strcmp().
16-bit character (UTF-16) version of strcpy().
size_t bt_xwcslen | ( | const BT_Char16 * | s1 | ) |
16-bit character (UTF-16) version of strlen().
16-bit character (UTF-16) version of strncmp().
16-bit character (UTF-16) version of strncpy().
16-bit character (UTF-16) version of strtol().
16-bit character (UTF-16) version of strtoul().
Copyright © 2004-2008 Basis Technology Corporation. All Rights Reserved.