UCommon
Public Member Functions | Protected Attributes
ucommon::utf8_pointer Class Reference

Pointer to utf8 encoded character data. More...

#include <unicode.h>

Public Member Functions

char * c_str (void) const
 Get c string we point to. More...
 
void dec (void)
 Iterative decrement of a utf8 pointer to prior codepoint.
 
void inc (void)
 Iterative increment of a utf8 pointer to next codepoint.
 
size_t len (void) const
 Get length of null terminated utf8 string in codepoints. More...
 
ucs4_t operator * () const
 Get unicode character pointed to by pointer. More...
 
utf8_pointeroperator -- ()
 Iterative decrement of a utf8 pointer to next codepoint. More...
 
utf8_pointeroperator -= (long offset)
 Adjust utf8 pointer by specified codepoints backward. More...
 
 operator bool () const
 Check if text is valid pointer. More...
 
 operator char * () const
 Convert utf8 pointer to a generic string pointer. More...
 
bool operator! () const
 Check if text is an invalid pointer. More...
 
bool operator!= (const char *string) const
 check if pointer does not equal another string. More...
 
utf8_pointer operator+ (long offset) const
 Get new utf8 string after adding a codepoint offset. More...
 
utf8_pointeroperator++ ()
 Iterative increment of a utf8 pointer to prior codepoint. More...
 
utf8_pointeroperator+= (long offset)
 Adjust utf8 pointer by specified codepoints forward. More...
 
utf8_pointer operator- (long offset) const
 Get new utf8 string after subtracting a codepoint offset. More...
 
utf8_pointeroperator= (const char *string)
 Assign a utf8 string to point to. More...
 
bool operator== (const char *string) const
 check if pointer equals another string. More...
 
ucs4_t operator[] (long codepoint) const
 Extract a unicode character from a specified codepoint. More...
 
 utf8_pointer ()
 Create a utf8 pointer set to NULL.
 
 utf8_pointer (const char *string)
 Create a utf8 pointer for an existing char pointer. More...
 
 utf8_pointer (const utf8_pointer &copy)
 Create a utf8 pointer as a copy of existing utf8 pointer. More...
 

Protected Attributes

uint8_t * text
 

Detailed Description

Pointer to utf8 encoded character data.

This is a kind of "char *" for utf8 text.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 403 of file unicode.h.

Constructor & Destructor Documentation

◆ utf8_pointer() [1/2]

ucommon::utf8_pointer::utf8_pointer ( const char *  string)

Create a utf8 pointer for an existing char pointer.

Parameters
stringpointer to use.

◆ utf8_pointer() [2/2]

ucommon::utf8_pointer::utf8_pointer ( const utf8_pointer copy)

Create a utf8 pointer as a copy of existing utf8 pointer.

Parameters
copyof object to use.

Member Function Documentation

◆ c_str()

char* ucommon::utf8_pointer::c_str ( void  ) const
inline

Get c string we point to.

Returns
string we point to.

Definition at line 536 of file unicode.h.

◆ len()

size_t ucommon::utf8_pointer::len ( void  ) const
inline

Get length of null terminated utf8 string in codepoints.

Returns
codepoint length of string.

Definition at line 552 of file unicode.h.

Here is the call graph for this function:

◆ operator *()

ucs4_t ucommon::utf8_pointer::operator * ( ) const
inline

Get unicode character pointed to by pointer.

Returns
unicode character we are pointing to.

Definition at line 528 of file unicode.h.

Here is the call graph for this function:

◆ operator --()

utf8_pointer& ucommon::utf8_pointer::operator -- ( )

Iterative decrement of a utf8 pointer to next codepoint.

Returns
object decremented.

◆ operator -=()

utf8_pointer& ucommon::utf8_pointer::operator -= ( long  offset)

Adjust utf8 pointer by specified codepoints backward.

Parameters
offsetto decrement by.
Returns
object decremented.

◆ operator bool()

ucommon::utf8_pointer::operator bool ( ) const
inline

Check if text is valid pointer.

Returns
true if not NULL.

Definition at line 470 of file unicode.h.

◆ operator char *()

ucommon::utf8_pointer::operator char * ( ) const
inline

Convert utf8 pointer to a generic string pointer.

Returns
generic string pointer.

Definition at line 544 of file unicode.h.

◆ operator!()

bool ucommon::utf8_pointer::operator! ( ) const
inline

Check if text is an invalid pointer.

Returns
false if not NULL.

Definition at line 478 of file unicode.h.

◆ operator!=()

bool ucommon::utf8_pointer::operator!= ( const char *  string) const
inline

check if pointer does not equal another string.

Parameters
stringto check.
Returns
false if same memory address.

Definition at line 520 of file unicode.h.

◆ operator+()

utf8_pointer ucommon::utf8_pointer::operator+ ( long  offset) const

Get new utf8 string after adding a codepoint offset.

Parameters
offsetto add.
Returns
new utf8 pointer pointing to specified offset.

◆ operator++()

utf8_pointer& ucommon::utf8_pointer::operator++ ( )

Iterative increment of a utf8 pointer to prior codepoint.

Returns
object incremented.

◆ operator+=()

utf8_pointer& ucommon::utf8_pointer::operator+= ( long  offset)

Adjust utf8 pointer by specified codepoints forward.

Parameters
offsetto increment by.
Returns
object incremented.

◆ operator-()

utf8_pointer ucommon::utf8_pointer::operator- ( long  offset) const

Get new utf8 string after subtracting a codepoint offset.

Parameters
offsetto subtract.
Returns
new utf8 pointer pointing to specified offset.

◆ operator=()

utf8_pointer& ucommon::utf8_pointer::operator= ( const char *  string)

Assign a utf8 string to point to.

Parameters
stringto point to.
Returns
current object after set to string.

◆ operator==()

bool ucommon::utf8_pointer::operator== ( const char *  string) const
inline

check if pointer equals another string.

Parameters
stringto check.
Returns
true if same memory address.

Definition at line 511 of file unicode.h.

◆ operator[]()

ucs4_t ucommon::utf8_pointer::operator[] ( long  codepoint) const

Extract a unicode character from a specified codepoint.

Parameters
codepointoffset to extract character from.
Returns
unicode character or 0.

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