sombok
2.3.0
|
Grapheme cluster string. More...
Data Structures | |
struct | unistr_t |
struct | gcchar_t |
struct | gcstring_t |
Functions | |
gcstring_t * | gcstring_new (unistr_t *unistr, linebreak_t *lbobj) |
gcstring_t * | gcstring_newcopy (unistr_t *str, linebreak_t *lbobj) |
gcstring_t * | gcstring_new_from_utf8 (char *str, size_t len, int check, linebreak_t *lbobj) |
void | gcstring_destroy (gcstring_t *gcstr) |
gcstring_t * | gcstring_copy (gcstring_t *gcstr) |
gcstring_t * | gcstring_append (gcstring_t *gcstr, gcstring_t *appe) |
int | gcstring_cmp (gcstring_t *a, gcstring_t *b) |
size_t | gcstring_columns (gcstring_t *gcstr) |
gcstring_t * | gcstring_concat (gcstring_t *gcstr, gcstring_t *appe) |
gcchar_t * | gcstring_next (gcstring_t *gcstr) |
void | gcstring_setpos (gcstring_t *gcstr, int pos) |
void | gcstring_shrink (gcstring_t *gcstr, int length) |
gcstring_t * | gcstring_substr (gcstring_t *gcstr, int offset, int length) |
gcstring_t * | gcstring_replace (gcstring_t *gcstr, int offset, int length, gcstring_t *replacement) |
propval_t | gcstring_lbclass (gcstring_t *gcstr, int pos) |
propval_t | gcstring_lbclass_ext (gcstring_t *gcstr, int pos) |
Grapheme cluster string.
gcstring_t* gcstring_append | ( | gcstring_t * | gcstr, |
gcstring_t * | appe | ||
) |
Append
Modify grapheme cluster string by appending another string.
[in] | gcstr | target grapheme cluster string, must not be NULL. |
[in] | appe | grapheme cluster string to be appended. NULL means null string therefore gcstr won't be modified. |
int gcstring_cmp | ( | gcstring_t * | a, |
gcstring_t * | b | ||
) |
Compare
Compare grapheme cluster strings.
[in] | a | grapheme cluster string. |
[in] | b | grapheme cluster string. |
size_t gcstring_columns | ( | gcstring_t * | gcstr | ) |
Number of Columns
Returns number of columns of grapheme cluster strings determined by built-in character database according to UAX #11.
[in] | gcstr | grapheme cluster string. NULL may mean null string. |
gcstring_t* gcstring_concat | ( | gcstring_t * | gcstr, |
gcstring_t * | appe | ||
) |
Concatenate
Create new grapheme cluster string which is concatination of two strings.
[in] | gcstr | grapheme cluster string, must not be NULL. |
[in] | appe | grapheme cluster string to be appended. NULL means null string. |
gcstring_t* gcstring_copy | ( | gcstring_t * | gcstr | ) |
Copy Constructor
Create deep copy of grapheme cluster string.
[in] | gcstr | grapheme cluster string, must not be NULL. |
void gcstring_destroy | ( | gcstring_t * | gcstr | ) |
Destructor
Free memories allocated for grapheme cluster string.
[in] | gcstr | grapheme cluster string. |
propval_t gcstring_lbclass | ( | gcstring_t * | gcstr, |
int | pos | ||
) |
Get Line Breaking Class of grapheme base
Get UAX #14 line breaking class of grapheme base.
[in] | gcstr | grapheme cluster string, must not be NULL. |
[in] | pos | position. |
propval_t gcstring_lbclass_ext | ( | gcstring_t * | gcstr, |
int | pos | ||
) |
Get Line Breaking Class of grapheme extender
Get UAX #14 line breaking class of grapheme extender. If it is CM, get one of grapheme base.
[in] | gcstr | grapheme cluster string, must not be NULL. |
[in] | pos | position. |
gcstring_t* gcstring_new | ( | unistr_t * | unistr, |
linebreak_t * | lbobj | ||
) |
Constructor
Create new grapheme cluster string from Unicode string. Use gcstring_newcopy() if you wish to copy buffer of Unicode string.
[in] | unistr | Unicode string. NULL may be given as zero-length string. |
[in] | lbobj | linebreak object. |
option bits of lbobj:
gcstring_t* gcstring_new_from_utf8 | ( | char * | str, |
size_t | len, | ||
int | check, | ||
linebreak_t * | lbobj | ||
) |
Constructor from UTF-8 string
Create new grapheme cluster string from UTF-8 string.
[in] | str | buffer of UTF-8 string, must not be NULL. |
[in] | len | length of UTF-8 string. |
[in] | check | check input. See sombok_decode_utf8(). |
[in] | lbobj | linebreak object. |
gcstring_t* gcstring_newcopy | ( | unistr_t * | str, |
linebreak_t * | lbobj | ||
) |
Constructor copying Unicode string.
Create new grapheme cluster string from Unicode string. Use gcstring_new() if you wish not to copy buffer of Unicode string.
[in] | str | Unicode string. NULL may be given as zero-length string. |
[in] | lbobj | linebreak object. |
gcchar_t* gcstring_next | ( | gcstring_t * | gcstr | ) |
Iterator
Returns pointer to next grapheme cluster of grapheme cluster string. Next position will be incremented.
[in] | gcstr | grapheme cluster string. |
gcstring_t* gcstring_replace | ( | gcstring_t * | gcstr, |
int | offset, | ||
int | length, | ||
gcstring_t * | replacement | ||
) |
Replace substring
Replace substring og grapheme cluster string. Offset and length are specified by number of grapheme clusters.
[in,out] | gcstr | grapheme cluster string. Must not be NULL. |
[in] | offset | Offset of substring. |
[in] | length | Length of substring. offset and length must not be out of range. |
[in] | replacement | If this was not NULL, modify grapheme cluster string by replacing substring with it. |
void gcstring_setpos | ( | gcstring_t * | gcstr, |
int | pos | ||
) |
Set Next Position
Set next position of grapheme cluster string.
[in] | gcstr | grapheme cluster string. |
[in] | pos | New position. |
void gcstring_shrink | ( | gcstring_t * | gcstr, |
int | length | ||
) |
Shrink
Modify grapheme cluster string to shrink its length. Length is specified by number of grapheme clusters.
[in] | gcstr | grapheme cluster string. |
[in] | length | New length. |
gcstring_t* gcstring_substr | ( | gcstring_t * | gcstr, |
int | offset, | ||
int | length | ||
) |
Substring
Returns substring of grapheme cluster string. Offset and length are specified by number of grapheme clusters.
[in] | gcstr | grapheme cluster string. Must not be NULL. |
[in] | offset | Offset of substring. |
[in] | length | Length of substring. |