docs
Loading...
Searching...
No Matches
String8

#include <Ultralight/String8.h>

Overview

A null-terminated UTF-8 string container.

Public Types

typedef char CharType
 Native character type.

Public Member Functions

 String8 ()
 Make an empty String8.
 String8 (const char *c_str)
 Make a String8 from raw, null-terminated UTF-8 string.
 String8 (const char *c_str, size_t len)
 Make a String8 from raw UTF-8 string with certain length.
 String8 (const String8 &other)
 Make a deep copy of String8.
 String8 (String8 &&other)
 Move constructor.
 ~String8 ()
 Destructor.
String8 & operator= (const String8 &other)
 Assign a String8 to this one, deep copy is made.
String8 & operator= (String8 &&other)
 Move assignment operator.
String8 & operator+= (const String8 &other)
 Append a String8 to this one.
char * data ()
 Get raw UTF-8 data.
const char * data () const
 Get raw UTF-8 data (const).
size_t length () const
 Get length in bytes (not including null terminator).
size_t size () const
 Get size in bytes (synonym for length()).
size_t sizeBytes () const
 Get size in bytes.
bool empty () const
 Check if string is empty.
char & operator[] (size_t pos)
 Get character at specific position.
const char & operator[] (size_t pos) const
 Get character at specific position (const).
String16 utf16 () const
 Get a UTF-16 copy of this string.
String32 utf32 () const
 Get a UTF-32 copy of this string.
size_t Hash () const
 Hash function.
bool operator< (const String8 &other) const
 Comparison operator.
bool operator== (const String8 &other) const
 Equality operator.
bool operator!= (const String8 &other) const
 Inequality operator.

Friends

String8 operator+ (String8 lhs, const String8 &rhs)
 Concatenation operator.

Member Typedef Documentation

◆ CharType

typedef char CharType

Native character type.

Constructor & Destructor Documentation

◆ String8() [1/5]

String8 ( )

Make an empty String8.

◆ String8() [2/5]

String8 ( const char * c_str)

Make a String8 from raw, null-terminated UTF-8 string.

◆ String8() [3/5]

String8 ( const char * c_str,
size_t len )

Make a String8 from raw UTF-8 string with certain length.

◆ String8() [4/5]

String8 ( const String8 & other)

Make a deep copy of String8.

◆ String8() [5/5]

String8 ( String8 && other)

Move constructor.

◆ ~String8()

~String8 ( )

Destructor.

Member Function Documentation

◆ data() [1/2]

char * data ( )
inline

Get raw UTF-8 data.

◆ data() [2/2]

const char * data ( ) const
inline

Get raw UTF-8 data (const).

◆ empty()

bool empty ( ) const
inline

Check if string is empty.

◆ Hash()

size_t Hash ( ) const

Hash function.

◆ length()

size_t length ( ) const
inline

Get length in bytes (not including null terminator).

◆ operator!=()

bool operator!= ( const String8 & other) const

Inequality operator.

◆ operator+=()

String8 & operator+= ( const String8 & other)

Append a String8 to this one.

◆ operator<()

bool operator< ( const String8 & other) const

Comparison operator.

◆ operator=() [1/2]

String8 & operator= ( const String8 & other)

Assign a String8 to this one, deep copy is made.

◆ operator=() [2/2]

String8 & operator= ( String8 && other)

Move assignment operator.

◆ operator==()

bool operator== ( const String8 & other) const

Equality operator.

◆ operator[]() [1/2]

char & operator[] ( size_t pos)
inline

Get character at specific position.

◆ operator[]() [2/2]

const char & operator[] ( size_t pos) const
inline

Get character at specific position (const).

◆ size()

size_t size ( ) const
inline

Get size in bytes (synonym for length()).

◆ sizeBytes()

size_t sizeBytes ( ) const
inline

Get size in bytes.

◆ utf16()

String16 utf16 ( ) const

Get a UTF-16 copy of this string.

◆ utf32()

String32 utf32 ( ) const

Get a UTF-32 copy of this string.

◆ operator+

String8 operator+ ( String8 lhs,
const String8 & rhs )
friend

Concatenation operator.


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