|
UCommon
|
A copy-on-write utf8 string class that operates by reference count. More...
#include <unicode.h>


Protected Member Functions | |
| void | add (const unicode_t unicode) |
| Add (append) unicode to a utf8 encoded string. | |
| ucs4_t | at (int position) const |
| Return unicode character found at a specific codepoint in the string. | |
| unsigned | ccount (ucs4_t character) const |
| Count occurrences of a unicode character in string. | |
| UString | copy (strsize_t offset, strsize_t size) const |
| Convenience method for substring extraction. | |
| strsize_t | count (void) const |
| Count codepoints in current string. | |
| void | cut (strsize_t offset, strsize_t size=0) |
| Cut (remove) text from string using codepoint offsets. | |
| const char * | find (ucs4_t character, strsize_t start=0) const |
| Find first occurrence of character in string. | |
| UString | get (strsize_t codepoint, strsize_t size=0) const |
| Get a new string object as a substring of the current object. | |
| size_t | get (unicode_t unicode, size_t size) const |
| Extract a unicode byte sequence from utf8 object. | |
| UString | left (strsize_t size) const |
| Convenience method for left of string. | |
| size_t | operator() (unicode_t unicode, size_t size) const |
| Extract a unicode byte sequence from utf8 object. | |
| UString | operator() (int codepoint, strsize_t size) const |
| Get a new substring through object expression. | |
| const char * | operator() (int offset) const |
| Reference a string in the object by codepoint offset. | |
| ucs4_t | operator[] (int position) const |
| Reference a unicode character in string object by array offset. | |
| void | paste (strsize_t offset, const char *text, strsize_t size=0) |
| Insert (paste) text into string using codepoint offsets. | |
| const char * | rfind (ucs4_t character, strsize_t end=npos) const |
| Find last occurrence of character in string. | |
| UString | right (strsize_t offset) const |
| Convenience method for right of string. | |
| void | set (const unicode_t unicode) |
| Set a utf8 encoded string based on unicode data. | |
| UString () | |
| Create a new empty utf8 aware string object. | |
| UString (strsize_t size) | |
| Create an empty string with a buffer pre-allocated to a specified size. | |
| UString (const unicode_t text) | |
| Create a utf8 aware string for a null terminated unicode string. | |
| UString (const char *text, strsize_t size) | |
| Create a string from null terminated text up to a maximum specified size. | |
| UString (const unicode_t *text, const unicode_t *end) | |
| Create a string for a substring. | |
| UString (const UString &existing) | |
| Construct a copy of a string object. | |
| virtual | ~UString () |
| Destroy string. | |
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.
| ucommon::UString::UString | ( | strsize_t | size | ) | [protected] |
Create an empty string with a buffer pre-allocated to a specified size.
| size | of buffer to allocate. |
| ucommon::UString::UString | ( | const unicode_t | text | ) | [protected] |
Create a utf8 aware string for a null terminated unicode string.
| text | of ucs4 encoded data. |
| ucommon::UString::UString | ( | const char * | text, |
| strsize_t | size | ||
| ) | [protected] |
Create a string from null terminated text up to a maximum specified size.
| text | to use for string. |
| size | limit of new string. |
| ucommon::UString::UString | ( | const unicode_t * | text, |
| const unicode_t * | end | ||
| ) | [protected] |
Create a string for a substring.
The end of the substring is a pointer within the substring itself.
| text | to use for string. |
| end | of text in substring. |
| ucommon::UString::UString | ( | const UString & | existing | ) | [protected] |
Construct a copy of a string object.
Our copy inherits the same reference counted instance of cstring as in the original.
| existing | string to copy from. |
| virtual ucommon::UString::~UString | ( | ) | [protected, virtual] |
Destroy string.
De-reference cstring. If last reference to cstring, then also remove cstring from heap.
| void ucommon::UString::add | ( | const unicode_t | unicode | ) | [protected] |
Add (append) unicode to a utf8 encoded string.
| unicode | text to add. |
| ucs4_t ucommon::UString::at | ( | int | position | ) | const [protected] |
Return unicode character found at a specific codepoint in the string.
| position | of codepoint in string, negative values computed from end. |
Reimplemented from ucommon::String.
| unsigned ucommon::UString::ccount | ( | ucs4_t | character | ) | const [protected] |
Count occurrences of a unicode character in string.
| character | code to search for. |
| UString ucommon::UString::copy | ( | strsize_t | offset, |
| strsize_t | size | ||
| ) | const [inline, protected] |
Convenience method for substring extraction.
| offset | into string. |
| size | of string to return. |
Reimplemented from ucommon::String.
| strsize_t ucommon::UString::count | ( | void | ) | const [inline, protected] |
Count codepoints in current string.
Reimplemented from ucommon::String.
Definition at line 360 of file unicode.h.

| void ucommon::UString::cut | ( | strsize_t | offset, |
| strsize_t | size = 0 |
||
| ) | [protected] |
Cut (remove) text from string using codepoint offsets.
| offset | to start of text field to remove. |
| size | of text field to remove or 0 to remove to end of string. |
Reimplemented from ucommon::String.
| const char* ucommon::UString::find | ( | ucs4_t | character, |
| strsize_t | start = 0 |
||
| ) | const [protected] |
Find first occurrence of character in string.
| character | code to search for. |
| start | offset in string in codepoints. |
| UString ucommon::UString::get | ( | strsize_t | codepoint, |
| strsize_t | size = 0 |
||
| ) | const [protected] |
Get a new string object as a substring of the current object.
| codepoint | offset of substring. |
| size | of substring in codepoints or 0 if to end. |
Reimplemented from ucommon::String.
| size_t ucommon::UString::get | ( | unicode_t | unicode, |
| size_t | size | ||
| ) | const [protected] |
Extract a unicode byte sequence from utf8 object.
| unicode | data buffer. |
| size | of data buffer. |
| UString ucommon::UString::left | ( | strsize_t | size | ) | const [inline, protected] |
Convenience method for left of string.
| size | of substring to gather in codepoints. |
Reimplemented from ucommon::String.
| size_t ucommon::UString::operator() | ( | unicode_t | unicode, |
| size_t | size | ||
| ) | const [inline, protected] |
Get a new substring through object expression.
| codepoint | offset of substring. |
| size | of substring or 0 if to end. |
Reimplemented from ucommon::String.
| const char* ucommon::UString::operator() | ( | int | offset | ) | const [protected] |
Reference a string in the object by codepoint offset.
Positive offsets are from the start of the string, negative from the end.
| offset | to string position. |
Reimplemented from ucommon::String.
| ucs4_t ucommon::UString::operator[] | ( | int | position | ) | const [inline, protected] |
Reference a unicode character in string object by array offset.
| position | of codepoint offset to character. |
Reimplemented from ucommon::String.
Definition at line 353 of file unicode.h.

| void ucommon::UString::paste | ( | strsize_t | offset, |
| const char * | text, | ||
| strsize_t | size = 0 |
||
| ) | [protected] |
Insert (paste) text into string using codepoint offsets.
| offset | to start paste. |
| text | to paste. |
| size | of text to paste. |
Reimplemented from ucommon::String.
| const char* ucommon::UString::rfind | ( | ucs4_t | character, |
| strsize_t | end = npos |
||
| ) | const [protected] |
Find last occurrence of character in string.
| character | code to search for. |
| end | offset to start from in codepoints. |
| UString ucommon::UString::right | ( | strsize_t | offset | ) | const [inline, protected] |
Convenience method for right of string.
| offset | of substring from right in codepoints. |
Reimplemented from ucommon::String.
| void ucommon::UString::set | ( | const unicode_t | unicode | ) | [protected] |
Set a utf8 encoded string based on unicode data.
| unicode | text to set. |
1.7.6.1