docs
Loading...
Searching...
No Matches
String16

#include <Ultralight/String16.h>

Overview

A null-terminated UTF-16 string container.

Public Types

typedef Char16 CharType
 Native character type.

Public Member Functions

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

Friends

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

Member Typedef Documentation

◆ CharType

typedef Char16 CharType

Native character type.

Constructor & Destructor Documentation

◆ String16() [1/5]

String16 ( )

Make an empty String16.

◆ String16() [2/5]

String16 ( const Char16 * str,
size_t len )

Make a String16 from raw UTF-16 buffer with certain length.

◆ String16() [3/5]

String16 ( const unsigned short * str,
size_t len )

Make a String16 from raw unsigned short UTF-16 buffer with certain length.

Useful on Windows when native support for wchar_t is disabled (eg, /Zc:wchar_t-).

◆ String16() [4/5]

String16 ( const String16 & other)

Make a deep copy of String16.

◆ String16() [5/5]

String16 ( String16 && other)

Move constructor.

◆ ~String16()

~String16 ( )

Destructor.

Member Function Documentation

◆ data() [1/2]

Char16 * data ( )
inline

Get raw UTF-16 data.

◆ data() [2/2]

const Char16 * data ( ) const
inline

Get raw UTF-16 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 UTF-16 code units (not including null terminator).

◆ operator!=()

bool operator!= ( const String16 & other) const

Inequality operator.

◆ operator+=()

String16 & operator+= ( const String16 & other)

Append a String16 to this one.

◆ operator<()

bool operator< ( const String16 & other) const

Comparison operator.

◆ operator=() [1/2]

String16 & operator= ( const String16 & other)

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

◆ operator=() [2/2]

String16 & operator= ( String16 && other)

Move assignment operator.

◆ operator==()

bool operator== ( const String16 & other) const

Equality operator.

◆ operator[]() [1/2]

Char16 & operator[] ( size_t pos)
inline

Get character at specific position.

◆ operator[]() [2/2]

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

Get character at specific position (const).

◆ size()

size_t size ( ) const
inline

Get size in UTF-16 code units (synonym for length()).

◆ sizeBytes()

size_t sizeBytes ( ) const
inline

Get size in bytes.

◆ udata() [1/2]

unsigned short * udata ( )
inline

Get raw UTF-16 data as unsigned short.

This is useful on Windows if you compile without native support for wchar_t (eg, /Zc:wchar_t-)

◆ udata() [2/2]

const unsigned short * udata ( ) const
inline

Get raw UTF-16 data as unsigned short (const).

◆ utf32()

String32 utf32 ( ) const

Get a UTF-32 copy of this string.

◆ utf8()

String8 utf8 ( ) const

Get a UTF-8 copy of this string.

◆ operator+

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

Concatenation operator.


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