docs
Loading...
Searching...
No Matches
CAPI_String.h

Overview

Unicode string container (natively UTF-8).

#include <Ultralight/CAPI/CAPI_String.h>

ULString is an opaque handle representing a Unicode string in Ultralight. It can be created from a variety of string types (ASCII, UTF-8, UTF-16) and accessed as a null-terminated UTF-8 buffer.

Functions

ULString ulCreateString (const char *str)
 Create string from a null-terminated UTF-8 C-string.
ULString ulCreateStringUTF8 (const char *str, size_t len)
 Create string from UTF-8 buffer with explicit length.
ULString ulCreateStringUTF16 (const ULChar16 *str, size_t len)
 Create string from UTF-16 buffer with explicit length.
ULString ulCreateStringFromCopy (ULString str)
 Create string from copy of existing string.
void ulDestroyString (ULString str)
 Destroy a string previously created with ulCreateString(), ulCreateStringUTF8(), ulCreateStringUTF16(), or ulCreateStringFromCopy().
char * ulStringGetData (ULString str)
 Get native UTF-8 buffer data (always null-terminated).
size_t ulStringGetLength (ULString str)
 Get length (in bytes) of the UTF-8 buffer data, not including null terminator.
bool ulStringIsEmpty (ULString str)
 Whether this string is empty or not.
void ulStringAssignString (ULString str, ULString new_str)
 Replaces the contents of 'str' with the contents of 'new_str'.
void ulStringAssignCString (ULString str, const char *c_str)
 Replaces the contents of 'str' with the contents of a C-string.

Function Documentation

◆ ulCreateString()

ULString ulCreateString ( const char * str)

Create string from a null-terminated UTF-8 C-string.

Parameters
strA null-terminated UTF-8 C-string.
Returns
A new ULString instance. You must call ulDestroyString() when finished.

◆ ulCreateStringFromCopy()

ULString ulCreateStringFromCopy ( ULString str)

Create string from copy of existing string.

Parameters
strThe string to copy.
Returns
A new ULString instance. You must call ulDestroyString() when finished.

◆ ulCreateStringUTF16()

ULString ulCreateStringUTF16 ( const ULChar16 * str,
size_t len )

Create string from UTF-16 buffer with explicit length.

Parameters
strPointer to a UTF-16 encoded buffer.
lenLength of the buffer in characters (not bytes).
Returns
A new ULString instance. You must call ulDestroyString() when finished.

◆ ulCreateStringUTF8()

ULString ulCreateStringUTF8 ( const char * str,
size_t len )

Create string from UTF-8 buffer with explicit length.

Parameters
strPointer to a UTF-8 encoded buffer (does not need to be null-terminated).
lenLength of the buffer in bytes.
Returns
A new ULString instance. You must call ulDestroyString() when finished.

◆ ulDestroyString()

void ulDestroyString ( ULString str)

Destroy a string previously created with ulCreateString(), ulCreateStringUTF8(), ulCreateStringUTF16(), or ulCreateStringFromCopy().

Parameters
strThe string to destroy.

◆ ulStringAssignCString()

void ulStringAssignCString ( ULString str,
const char * c_str )

Replaces the contents of 'str' with the contents of a C-string.

◆ ulStringAssignString()

void ulStringAssignString ( ULString str,
ULString new_str )

Replaces the contents of 'str' with the contents of 'new_str'.

◆ ulStringGetData()

char * ulStringGetData ( ULString str)

Get native UTF-8 buffer data (always null-terminated).

◆ ulStringGetLength()

size_t ulStringGetLength ( ULString str)

Get length (in bytes) of the UTF-8 buffer data, not including null terminator.

◆ ulStringIsEmpty()

bool ulStringIsEmpty ( ULString str)

Whether this string is empty or not.

Go to the source code of this file.