|
Mac Dev Center
Mac OS X Reference Library Networking, Internet, & Web JavaScriptCore Framework Reference
|
JSStringRef.h |
| Includes: |
Use the links in the table of contents to the left to access the documentation.
Creates a JavaScript string from a buffer of Unicode characters.
Creates a JavaScript string from a null-terminated UTF8 string.
Returns a pointer to the Unicode character buffer that serves as the backing store for a JavaScript string.
Returns the number of Unicode characters in a JavaScript string.
Returns the maximum number of bytes a JavaScript string will take up if converted into a null-terminated UTF8 string.
Converts a JavaScript string into a null-terminated UTF8 string, and copies the result into an external byte buffer.
Tests whether two JavaScript strings match.
Tests whether a JavaScript string matches a null-terminated UTF8 string.
Releases a JavaScript string.
Retains a JavaScript string.
JSStringCreateWithCharacters |
Creates a JavaScript string from a buffer of Unicode characters.
JS_EXPORT JSStringRef JSStringCreateWithCharacters( const JSChar* chars, size_t numChars);
charsThe buffer of Unicode characters to copy into the new JSString.
numCharsThe number of characters to copy from the buffer pointed to by chars.
A JSString containing chars. Ownership follows the Create Rule.
JSStringCreateWithUTF8CString |
Creates a JavaScript string from a null-terminated UTF8 string.
JS_EXPORT JSStringRef JSStringCreateWithUTF8CString( const char* string);
stringThe null-terminated UTF8 string to copy into the new JSString.
A JSString containing string. Ownership follows the Create Rule.
JSStringGetCharactersPtr |
Returns a pointer to the Unicode character buffer that serves as the backing store for a JavaScript string.
JS_EXPORT const JSChar* JSStringGetCharactersPtr(JSStringRef string);
stringThe JSString whose backing store you want to access.
A pointer to the Unicode character buffer that serves as string's backing store, which will be deallocated when string is deallocated.
JSStringGetLength |
Returns the number of Unicode characters in a JavaScript string.
JS_EXPORT size_t JSStringGetLength( JSStringRef string);
stringThe JSString whose length (in Unicode characters) you want to know.
The number of Unicode characters stored in string.
JSStringGetMaximumUTF8CStringSize |
Returns the maximum number of bytes a JavaScript string will take up if converted into a null-terminated UTF8 string.
JS_EXPORT size_t JSStringGetMaximumUTF8CStringSize( JSStringRef string);
stringThe JSString whose maximum converted size (in bytes) you want to know.
The maximum number of bytes that could be required to convert string into a null-terminated UTF8 string. The number of bytes that the conversion actually ends up requiring could be less than this, but never more.
JSStringGetUTF8CString |
Converts a JavaScript string into a null-terminated UTF8 string, and copies the result into an external byte buffer.
JS_EXPORT size_t JSStringGetUTF8CString( JSStringRef string, char *buffer, size_t bufferSize);
stringThe source JSString.
bufferThe destination byte buffer into which to copy a null-terminated UTF8 representation of string. On return, buffer contains a UTF8 string representation of string. If bufferSize is too small, buffer will contain only partial results. If buffer is not at least bufferSize bytes in size, behavior is undefined.
bufferSizeThe size of the external buffer in bytes.
The number of bytes written into buffer (including the null-terminator byte).
JSStringIsEqual |
Tests whether two JavaScript strings match.
JS_EXPORT bool JSStringIsEqual( JSStringRef a, JSStringRef b);
aThe first JSString to test.
bThe second JSString to test.
true if the two strings match, otherwise false.
JSStringIsEqualToUTF8CString |
Tests whether a JavaScript string matches a null-terminated UTF8 string.
JS_EXPORT bool JSStringIsEqualToUTF8CString( JSStringRef a, const char* b);
aThe JSString to test.
bThe null-terminated UTF8 string to test.
true if the two strings match, otherwise false.
JSStringRelease |
Releases a JavaScript string.
JS_EXPORT void JSStringRelease( JSStringRef string);
stringThe JSString to release.
JSStringRetain |
Retains a JavaScript string.
JS_EXPORT JSStringRef JSStringRetain( JSStringRef string);
stringThe JSString to retain.
A JSString that is the same as string.
A Unicode character.
JSChar |
A Unicode character.
typedef unsigned short JSChar;
Last Updated: 2009-08-12