C++ bindings for cgul_hchar
More...
#include <cgul_hchar_cxx.h>
Static Public Member Functions | |
static size_t | hcslen (const cgul_hchar_t *hs) |
static void | hcscpy (cgul_hchar_t *dst, const cgul_hchar_t *src) |
static int | hcscmp (const cgul_hchar_t *hs1, const cgul_hchar_t *hs2) |
static int | isspace (cgul_hchar_t hc) |
This class provides the C++ bindings for C cgul_hchar
external functions. The main purpose of this class is to convert the C-style function calls and exception handling in cgul_hchar
into C++-style function calls and exception handling.
|
inlinestatic |
This function returns the number of 16-bit wide-characters in hs
. The return value is determined by counting all the wide characters that come before the trailing NUL wide character. The caller is responsible for insuring that hs
is NUL-terminated.
Note that this function does assumes the string is UCS-2, not UTF-16, encoded. Thus if the string is actually UTF-16 encoded, surrogate pairs will count as two characters. If you need an exact count of unicode characters, use cgul_unicode_cxx::get_hchar_count()
instead.
[in] | hs | 16-bit wide-character string |
hs
References cgul_hchar__hcslen().
|
inlinestatic |
This function copies the 16-bit wide characters in src
to dst
. The caller is responsible for making sure that src
is NUL-terminated and that dst
is large enough to hold all the characters in src
including the trailing NUL character.
[in] | dst | destination 16-bit wide-character string |
[in] | src | source 16-bit wide-character string |
References cgul_hchar__hcscpy().
|
inlinestatic |
Perform a case-significant, 16-bit, wide-character string comparison of hs1
and hs2
. Return -1, 0, or 1 if hs1
is less than, equal to, or greater than hs2
respectively.
For simplicity, this function compares strings stricly by the ordinal value of each character which should be sufficient, for example, when comparing strings when inserting them as keys into a cgul_rbtree
; however, the comparison results are not likely to be the same as what strcoll()
would return if used on the UTF-8 version of the strings.
cgul_exception
object as its first parameter in order to make it easier to use the function as the comparison function of cgul_rbtree
objects. [in] | hs1 | left-hand side |
[in] | hs2 | right-hand side |
hs1
is less than, equal to, or greater than hs2
respectively References cgul_hchar__hcscmp().
|
inlinestatic |
Return whether the 16-bit, wide character hc
is considered to be white-space. To avoid locale dependencies, white-space is defined as any character from the following list: ' ', '\t', '\n', '\r', '\f', '\v'
[in] | hc | 16-bit, wide character |
References cgul_hchar__isspace().