A copy-on-write utf8 string class that operates by reference count.
More...
#include <unicode.h>
Detailed Description
A copy-on-write utf8 string class that operates by reference count.
This is derived from the classic uCommon String class by adding operations that are utf8 encoding aware.
- Author:
- David Sugar <dyfet@gnutelephony.org>
Definition at line 193 of file unicode.h.
Constructor & Destructor Documentation
Create an empty string with a buffer pre-allocated to a specified size.
- Parameters:
-
size | of buffer to allocate. |
Create a utf8 aware string for a null terminated unicode string.
- Parameters:
-
text | of ucs4 encoded data. |
Create a string from null terminated text up to a maximum specified size.
- Parameters:
-
text | to use for string. |
size | limit of new string. |
Create a string for a substring.
The end of the substring is a pointer within the substring itself.
- Parameters:
-
text | to use for string. |
end | of text in substring. |
Construct a copy of a string object.
Our copy inherits the same reference counted instance of cstring as in the original.
- Parameters:
-
existing | string to copy from. |
Destroy string.
De-reference cstring. If last reference to cstring, then also remove cstring from heap.
Member Function Documentation
Add (append) unicode to a utf8 encoded string.
- Parameters:
-
Return unicode character found at a specific codepoint in the string.
- Parameters:
-
position | of codepoint in string, negative values computed from end. |
- Returns:
- character code at specified position in string.
Reimplemented from ucommon::string.
Count occurrences of a unicode character in string.
- Parameters:
-
character | code to search for. |
- Returns:
- count of occurrences.
Count codepoints in current string.
- Returns:
- count of codepoints.
Reimplemented from ucommon::string.
Definition at line 315 of file unicode.h.
Find first occurrence of character in string.
- Parameters:
-
character | code to search for. |
start | offset in string in codepoints. |
- Returns:
- pointer to first instance or NULL if not found.
Get a new string object as a substring of the current object.
- Parameters:
-
codepoint | offset of substring. |
size | of substring in codepoints or 0 if to end. |
- Returns:
- string object holding substring.
Reimplemented from ucommon::string.
Extract a unicode byte sequence from utf8 object.
- Parameters:
-
unicode | data buffer. |
size | of data buffer. |
- Returns:
- codepoints copied.
size_t ucommon::UString::operator() |
( |
unicode_t |
unicode, |
|
|
size_t |
size |
|
) |
| [inline, protected] |
Extract a unicode byte sequence from utf8 object.
- Parameters:
-
unicode | data buffer. |
size | of data buffer. |
- Returns:
- codepoints copied.
Definition at line 283 of file unicode.h.
UString ucommon::UString::operator() |
( |
int |
codepoint, |
|
|
strsize_t |
size |
|
) |
| [protected] |
Get a new substring through object expression.
- Parameters:
-
codepoint | offset of substring. |
size | of substring or 0 if to end. |
- Returns:
- string object holding substring.
Reimplemented from ucommon::string.
char* ucommon::UString::operator() |
( |
int |
offset | ) |
[protected] |
Reference a string in the object by codepoint offset.
Positive offsets are from the start of the string, negative from the end.
- Parameters:
-
offset | to string position. |
- Returns:
- pointer to string data or NULL if invalid offset.
Reimplemented from ucommon::string.
ucs4_t ucommon::UString::operator[] |
( |
int |
position | ) |
[inline, protected] |
Reference a unicode character in string object by array offset.
- Parameters:
-
position | of codepoint offset to character. |
- Returns:
- character value at offset.
Reimplemented from ucommon::string.
Definition at line 308 of file unicode.h.
Find last occurrence of character in string.
- Parameters:
-
character | code to search for. |
end | offset to start from in codepoints. |
- Returns:
- pointer to last instance or NULL if not found.
Set a utf8 encoded string based on unicode data.
- Parameters:
-
The documentation for this class was generated from the following file: