utf8rewind
 All Classes Namespaces Files Functions Typedefs Friends Macros Pages
utf8rewind::Utf8String Class Reference

Class for managing UTF-8 encoded text. More...

#include <utf8string.hpp>

Classes

class  iterator
 Read-only class for stepping through a Utf8String instance. More...
 

Public Member Functions

 Utf8String ()
 
 Utf8String (const Utf8String &other)
 
 Utf8String (const char *text)
 
 Utf8String (const wchar_t *text)
 
Utf8Stringoperator= (const Utf8String &other)
 
Utf8Stringoperator= (const char *text)
 
Utf8Stringoperator= (const wchar_t *text)
 
iterator begin ()
 Get an iterator for the start of the string. More...
 
iterator end ()
 Get an iterator for the end of the string. More...
 
size_t length () const
 Get the length in codepoints. More...
 
size_t size () const
 Get the size in bytes of the container. More...
 
void clear ()
 Clear the string. More...
 
bool empty () const
 Check if the string is empty. More...
 
const char * c_str () const
 Get a pointer to the string's data. More...
 

Detailed Description

Class for managing UTF-8 encoded text.

Constructor & Destructor Documentation

utf8rewind::Utf8String::Utf8String ( )
utf8rewind::Utf8String::Utf8String ( const Utf8String other)
utf8rewind::Utf8String::Utf8String ( const char *  text)
utf8rewind::Utf8String::Utf8String ( const wchar_t *  text)

Member Function Documentation

iterator utf8rewind::Utf8String::begin ( )

Get an iterator for the start of the string.

The begin iterator will always point to the first byte of the string.

If the string is not valid or empty, the begin and end iterators will point to the same byte.

const char* utf8rewind::Utf8String::c_str ( ) const

Get a pointer to the string's data.

void utf8rewind::Utf8String::clear ( )

Clear the string.

When the string is cleared, the internal buffer is emptied, but the last byte is still an end-of-data character (0).

bool utf8rewind::Utf8String::empty ( ) const

Check if the string is empty.

iterator utf8rewind::Utf8String::end ( )

Get an iterator for the end of the string.

The end iterator will always point to the last byte of the string and is guaranteed to be 0.

If the string is not valid or empty, the begin and end iterators will point to the same byte.

size_t utf8rewind::Utf8String::length ( ) const

Get the length in codepoints.

The length in codepoints of a UTF-8 string is not equal to the size in bytes minues one because UTF-8 encoded text uses a variable amount of bytes for each codepoint.s

Utf8String& utf8rewind::Utf8String::operator= ( const Utf8String other)
Utf8String& utf8rewind::Utf8String::operator= ( const char *  text)
Utf8String& utf8rewind::Utf8String::operator= ( const wchar_t *  text)
size_t utf8rewind::Utf8String::size ( ) const

Get the size in bytes of the container.


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