16 template<
int>
struct selector;
17 template<>
struct selector<4> {
typedef char16_t Char16; };
18 template<>
struct selector<2> {
typedef wchar_t Char16; };
21#ifdef DISABLE_NATIVE_WCHAR_T
45 String16(
const unsigned short* str,
size_t len);
76 unsigned short*
udata() {
return reinterpret_cast<unsigned short*
>(data_); }
79 const unsigned short*
udata()
const {
return reinterpret_cast<const unsigned short*
>(data_); }
82 size_t length()
const {
return length_; }
85 size_t size()
const {
return length_; }
91 bool empty()
const {
return !data_ || length_ == 0; }
140 virtual size_t size()
const = 0;
#define UExport
Definition Exports.h:22
Interface for all ref-counted objects that will be managed using the RefPtr<> smart pointer.
Definition RefPtr.h:49
A nullable smart pointer.
Definition RefPtr.h:126
A null-terminated UTF-16 string container.
Definition String16.h:32
String16()
Make an empty String16.
friend String16 operator+(String16 lhs, const String16 &rhs)
Concatenation operator.
Definition String16.h:66
String16(const unsigned short *str, size_t len)
Make a String16 from raw unsigned short UTF-16 buffer with certain length.
const Char16 & operator[](size_t pos) const
Get character at specific position (const).
Definition String16.h:97
size_t size() const
Get size in UTF-16 code units (synonym for length()).
Definition String16.h:85
String16 & operator=(String16 &&other)
Move assignment operator.
const unsigned short * udata() const
Get raw UTF-16 data as unsigned short (const).
Definition String16.h:79
String8 utf8() const
Get a UTF-8 copy of this string.
bool empty() const
Check if string is empty.
Definition String16.h:91
size_t length() const
Get length in UTF-16 code units (not including null terminator).
Definition String16.h:82
Char16 & operator[](size_t pos)
Get character at specific position.
Definition String16.h:94
String32 utf32() const
Get a UTF-32 copy of this string.
String16(const String16 &other)
Make a deep copy of String16.
size_t sizeBytes() const
Get size in bytes.
Definition String16.h:88
bool operator<(const String16 &other) const
Comparison operator.
bool operator==(const String16 &other) const
Equality operator.
String16 & operator=(const String16 &other)
Assign a String16 to this one, deep copy is made.
unsigned short * udata()
Get raw UTF-16 data as unsigned short.
Definition String16.h:76
String16 & operator+=(const String16 &other)
Append a String16 to this one.
size_t Hash() const
Hash function.
const Char16 * data() const
Get raw UTF-16 data (const).
Definition String16.h:72
Char16 * data()
Get raw UTF-16 data.
Definition String16.h:69
String16(String16 &&other)
Move constructor.
bool operator!=(const String16 &other) const
Inequality operator.
Char16 CharType
Native character type.
Definition String16.h:35
String16(const Char16 *str, size_t len)
Make a String16 from raw UTF-16 buffer with certain length.
String16Vector(const String16Vector &)
static RefPtr< String16Vector > Create(const String16 *stringArray, size_t len)
Create a string vector from an existing array (a deep copy is made).
virtual void push_back(const String16 &val)=0
Add an element to the back of the string vector.
virtual String16 * data()=0
Get raw String16 vector array.
void operator=(const String16Vector &)
virtual size_t size() const =0
Get the number of elements in vector.
static RefPtr< String16Vector > Create()
Create an empty string vector.
virtual ~String16Vector()
A null-terminated UTF-32 string container.
Definition String32.h:17
A null-terminated UTF-8 string container.
Definition String8.h:17
Root namespace for every public Ultralight type, function, and enumeration.
detail::selector< sizeof(wchar_t)>::Char16 Char16
We use wchar_t if size == 2, otherwise use char16_t.
Definition String16.h:26