Ultralight C API 1.3.0
Loading...
Searching...
No Matches
JSStringRef.h File Reference

Go to the source code of this file.

Functions

JSStringRef JSStringCreateWithCharacters (const JSChar *chars, size_t numChars)
 Creates a JavaScript string from a buffer of Unicode characters.
 
JSStringRef JSStringCreateWithUTF8CString (const char *string)
 Creates a JavaScript string from a null-terminated UTF8 string.
 
JSStringRef JSStringRetain (JSStringRef string)
 Retains a JavaScript string.
 
void JSStringRelease (JSStringRef string)
 Releases a JavaScript string.
 
size_t JSStringGetLength (JSStringRef string)
 Returns the number of Unicode characters in a JavaScript string.
 
const JSCharJSStringGetCharactersPtr (JSStringRef string)
 Returns a pointer to the Unicode character buffer that serves as the backing store for a JavaScript string.
 
size_t JSStringGetMaximumUTF8CStringSize (JSStringRef string)
 Returns the maximum number of bytes a JavaScript string will take up if converted into a null-terminated UTF8 string.
 
size_t JSStringGetUTF8CString (JSStringRef string, char *buffer, size_t bufferSize)
 Converts a JavaScript string into a null-terminated UTF8 string, and copies the result into an external byte buffer.
 
bool JSStringIsEqual (JSStringRef a, JSStringRef b)
 Tests whether two JavaScript strings match.
 
bool JSStringIsEqualToUTF8CString (JSStringRef a, const char *b)
 Tests whether a JavaScript string matches a null-terminated UTF8 string.
 

Typedefs

typedef unsigned short JSChar
 A UTF-16 code unit. One, or a sequence of two, can encode any Unicode character. As with all scalar types, endianness depends on the underlying architecture.
 

Function Documentation

◆ JSStringCreateWithCharacters()

JSStringRef JSStringCreateWithCharacters ( const JSChar chars,
size_t  numChars 
)

Creates a JavaScript string from a buffer of Unicode characters.

◆ JSStringCreateWithUTF8CString()

JSStringRef JSStringCreateWithUTF8CString ( const char *  string)

Creates a JavaScript string from a null-terminated UTF8 string.

◆ JSStringGetCharactersPtr()

const JSChar * JSStringGetCharactersPtr ( JSStringRef  string)

Returns a pointer to the Unicode character buffer that serves as the backing store for a JavaScript string.

◆ JSStringGetLength()

size_t JSStringGetLength ( JSStringRef  string)

Returns the number of Unicode characters in a JavaScript string.

◆ JSStringGetMaximumUTF8CStringSize()

size_t JSStringGetMaximumUTF8CStringSize ( JSStringRef  string)

Returns the maximum number of bytes a JavaScript string will take up if converted into a null-terminated UTF8 string.

◆ JSStringGetUTF8CString()

size_t JSStringGetUTF8CString ( JSStringRef  string,
char *  buffer,
size_t  bufferSize 
)

Converts a JavaScript string into a null-terminated UTF8 string, and copies the result into an external byte buffer.

◆ JSStringIsEqual()

bool JSStringIsEqual ( JSStringRef  a,
JSStringRef  b 
)

Tests whether two JavaScript strings match.

◆ JSStringIsEqualToUTF8CString()

bool JSStringIsEqualToUTF8CString ( JSStringRef  a,
const char *  b 
)

Tests whether a JavaScript string matches a null-terminated UTF8 string.

◆ JSStringRelease()

void JSStringRelease ( JSStringRef  string)

Releases a JavaScript string.

◆ JSStringRetain()

JSStringRef JSStringRetain ( JSStringRef  string)

Retains a JavaScript string.

Typedef Documentation

◆ JSChar

typedef unsigned short JSChar

A UTF-16 code unit. One, or a sequence of two, can encode any Unicode character. As with all scalar types, endianness depends on the underlying architecture.