cgul_hchar_cxx Class Reference

C++ bindings for cgul_hchar More...

#include <cgul_hchar_cxx.h>

Collaboration diagram for cgul_hchar_cxx:
Collaboration graph

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)
 

Detailed Description

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.

Member Function Documentation

§ hcslen()

static size_t cgul_hchar_cxx::hcslen ( const cgul_hchar_t hs)
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.

Parameters
[in]hs16-bit wide-character string
Returns
number of 16-bit wide characters in hs

References cgul_hchar__hcslen().

§ hcscpy()

static void cgul_hchar_cxx::hcscpy ( cgul_hchar_t dst,
const cgul_hchar_t src 
)
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.

Parameters
[in]dstdestination 16-bit wide-character string
[in]srcsource 16-bit wide-character string

References cgul_hchar__hcscpy().

§ hcscmp()

static int cgul_hchar_cxx::hcscmp ( const cgul_hchar_t hs1,
const cgul_hchar_t hs2 
)
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.

Note
This function does not take a 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.
Parameters
[in]hs1left-hand side
[in]hs2right-hand side
Returns
-1, 0, or 1 if hs1 is less than, equal to, or greater than hs2 respectively
See also
cgul_hstring_cxx::compare()

References cgul_hchar__hcscmp().

§ isspace()

static int cgul_hchar_cxx::isspace ( cgul_hchar_t  hc)
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'

Parameters
[in]hc16-bit, wide character
Returns
whether the character is white-space

References cgul_hchar__isspace().


The documentation for this class was generated from the following file: