A core class of ut8 encoded string functions.
More...
#include <unicode.h>
Public Member Functions |
ucs4_t | getch (FILE *file) |
| Get a unicode character from a file stream.
|
ucs4_t | putch (ucs4_t character, FILE *file) |
| Push a unicode character to a file stream.
|
Static Public Member Functions |
static unsigned | ccount (const char *string, ucs4_t character) |
| Count occurences of a unicode character in string.
|
static size_t | chars (const unicode_t string) |
| How many chars requires to encode a given wchar string.
|
static size_t | chars (ucs4_t character) |
| How many chars requires to encode a given unicode character.
|
static ucs4_t | codepoint (const char *encoded) |
| Convert a utf8 encoded codepoint to a ucs4 character value.
|
static size_t | convert (const unicode_t string, char *buffer, size_t size) |
| Convert a unicode string into utf8.
|
static size_t | count (const char *string) |
| Count ut8 encoded ucs4 codepoints in string.
|
static size_t | extract (const char *string, unicode_t unicode, size_t size) |
| Convert a utf8 string into a unicode data buffer.
|
static const char * | find (const char *string, ucs4_t character, size_t start=0) |
| Find first occurance of character in string.
|
static char * | offset (char *string, ssize_t position) |
| Get codepoint offset in a string.
|
static const char * | rfind (const char *string, ucs4_t character, size_t end=(size_t)-1l) |
| Find last occurance of character in string.
|
static unsigned | size (const char *codepoint) |
| Compute character size of utf8 string codepoint.
|
Static Public Attributes |
static const char * | nil |
| A convenient NULL pointer value.
|
static const unsigned | ucsize |
| Size of "unicode_t" character codes, may not be ucs4_t size.
|
Detailed Description
A core class of ut8 encoded string functions.
This is a foundation for all utf8 string processing.
- Author:
- David Sugar
Definition at line 62 of file unicode.h.
Member Function Documentation
static unsigned ucc::utf8::ccount |
( |
const char * |
string, |
|
|
ucs4_t |
character | |
|
) |
| | [static] |
Count occurences of a unicode character in string.
- Parameters:
-
| string | to search in. |
| character | code to search for. |
- Returns:
- count of occurences.
static size_t ucc::utf8::chars |
( |
const unicode_t |
string |
) |
[static] |
How many chars requires to encode a given wchar string.
- Parameters:
-
- Returns:
- number of chars required to encode given string.
static size_t ucc::utf8::chars |
( |
ucs4_t |
character |
) |
[static] |
How many chars requires to encode a given unicode character.
- Parameters:
-
- Returns:
- number of chars required to encode given character.
static ucs4_t ucc::utf8::codepoint |
( |
const char * |
encoded |
) |
[static] |
Convert a utf8 encoded codepoint to a ucs4 character value.
- Parameters:
-
- Returns:
- ucs4 string or 0 if invalid.
static size_t ucc::utf8::convert |
( |
const unicode_t |
string, |
|
|
char * |
buffer, |
|
|
size_t |
size | |
|
) |
| | [static] |
Convert a unicode string into utf8.
- Parameters:
-
| string | of unicode data. |
| buffer | to convert into. |
| size | of conversion buffer. |
- Returns:
- number of code points converted.
static size_t ucc::utf8::count |
( |
const char * |
string |
) |
[static] |
Count ut8 encoded ucs4 codepoints in string.
- Parameters:
-
- Returns:
- codepount count, 0 if empty or invalid.
static size_t ucc::utf8::extract |
( |
const char * |
string, |
|
|
unicode_t |
unicode, |
|
|
size_t |
size | |
|
) |
| | [static] |
Convert a utf8 string into a unicode data buffer.
- Parameters:
-
| string | to copy. |
| unicode | data buffer. |
| size | of unicode data buffer in codepoints. |
- Returns:
- number of code points converted.
static const char* ucc::utf8::find |
( |
const char * |
string, |
|
|
ucs4_t |
character, |
|
|
size_t |
start = 0 | |
|
) |
| | [static] |
Find first occurance of character in string.
- Parameters:
-
| string | to search in. |
| character | code to search for. |
| start | offset in string in codepoints. |
- Returns:
- pointer to first instance or NULL if not found.
ucs4_t ucc::utf8::getch |
( |
FILE * |
file |
) |
|
Get a unicode character from a file stream.
- Parameters:
-
| file | to get character from. |
- Returns:
- unicode character or EOF error.
static char* ucc::utf8::offset |
( |
char * |
string, |
|
|
ssize_t |
position | |
|
) |
| | [static] |
Get codepoint offset in a string.
- Parameters:
-
| string | of utf8 data. |
| position | of codepoint in string, negative offsets are from tail. |
- Returns:
- offset of codepoint or NULL if invalid.
Push a unicode character to a file stream.
- Parameters:
-
| character | to push to file. |
| file | to push character to. |
- Returns:
- unicode character or EOF on error.
static const char* ucc::utf8::rfind |
( |
const char * |
string, |
|
|
ucs4_t |
character, |
|
|
size_t |
end = (size_t)-1l | |
|
) |
| | [static] |
Find last occurance of character in string.
- Parameters:
-
| string | to search in. |
| character | code to search for. |
| end | offset to start from in codepoints. |
- Returns:
- pointer to last instance or NULL if not found.
static unsigned ucc::utf8::size |
( |
const char * |
codepoint |
) |
[static] |
Compute character size of utf8 string codepoint.
- Parameters:
-
- Returns:
- size of codepoint as utf8 encoded data, 0 if invalid.
The documentation for this class was generated from the following file: