A JavaScript string value (ECMA-262, 4.3.17). More...
#include <v8.h>
Data Structures | |
| class | AsciiValue |
| Converts an object to an ASCII string. More... | |
| class | ExternalAsciiStringResource |
| An ExternalAsciiStringResource is a wrapper around an ASCII string buffer that resides outside V8's heap. More... | |
| class | ExternalStringResource |
| An ExternalStringResource is a wrapper around a two-byte string buffer that resides outside V8's heap. More... | |
| class | ExternalStringResourceBase |
| class | Utf8Value |
| Converts an object to a UTF-8-encoded character array. More... | |
| class | Value |
| Converts an object to a two-byte string. More... | |
Public Types | |
| enum | WriteOptions { NO_OPTIONS = 0, HINT_MANY_WRITES_EXPECTED = 1, NO_NULL_TERMINATION = 2 } |
Write the contents of the string to an external buffer. More... | |
Public Member Functions | |
| V8EXPORT bool | CanMakeExternal () |
| Returns true if this string can be made external. | |
| V8EXPORT ExternalAsciiStringResource * | GetExternalAsciiStringResource () const |
| Get the ExternalAsciiStringResource for an external ASCII string. | |
| ExternalStringResource * | GetExternalStringResource () const |
| Get the ExternalStringResource for an external string. | |
| V8EXPORT bool | IsExternal () const |
| Returns true if the string is external. | |
| V8EXPORT bool | IsExternalAscii () const |
| Returns true if the string is both external and ASCII. | |
| V8EXPORT int | Length () const |
| Returns the number of characters in this string. | |
| V8EXPORT bool | MakeExternal (ExternalAsciiStringResource *resource) |
| Associate an external string resource with this string by transforming it in place so that existing references to this string in the JavaScript heap will use the external string resource. | |
| V8EXPORT bool | MakeExternal (ExternalStringResource *resource) |
| Associate an external string resource with this string by transforming it in place so that existing references to this string in the JavaScript heap will use the external string resource. | |
| V8EXPORT int | Utf8Length () const |
| Returns the number of bytes in the UTF-8 encoded representation of this string. | |
| V8EXPORT int | Write (uint16_t *buffer, int start=0, int length=-1, int options=NO_OPTIONS) const |
| V8EXPORT int | WriteAscii (char *buffer, int start=0, int length=-1, int options=NO_OPTIONS) const |
| V8EXPORT int | WriteUtf8 (char *buffer, int length=-1, int *nchars_ref=NULL, int options=NO_OPTIONS) const |
Static Public Member Functions | |
| static String * | Cast (v8::Value *obj) |
| static V8EXPORT Local< String > | Concat (Handle< String > left, Handle< String >right) |
| Creates a new string by concatenating the left and the right strings passed in as parameters. | |
| static V8EXPORT v8::Local < v8::String > | Empty () |
| A zero length string. | |
| static V8EXPORT Local< String > | New (const uint16_t *data, int length=-1) |
| Allocates a new string from 16-bit character codes. | |
| static V8EXPORT Local< String > | New (const char *data, int length=-1) |
| Allocates a new string from either UTF-8 encoded or ASCII data. | |
| static V8EXPORT Local< String > | NewExternal (ExternalAsciiStringResource *resource) |
| Creates a new external string using the ASCII data defined in the given resource. | |
| static V8EXPORT Local< String > | NewExternal (ExternalStringResource *resource) |
| Creates a new external string using the data defined in the given resource. | |
| static V8EXPORT Local< String > | NewSymbol (const char *data, int length=-1) |
| Creates a symbol. | |
| static V8EXPORT Local< String > | NewUndetectable (const uint16_t *data, int length=-1) |
| Creates an undetectable string from the supplied 16-bit character codes. | |
| static V8EXPORT Local< String > | NewUndetectable (const char *data, int length=-1) |
| Creates an undetectable string from the supplied ASCII or UTF-8 data. | |
A JavaScript string value (ECMA-262, 4.3.17).
Definition at line 1010 of file v8.h.
Write the contents of the string to an external buffer.
If no arguments are given, expects the buffer to be large enough to hold the entire string and NULL terminator. Copies the contents of the string and the NULL terminator into the buffer.
WriteUtf8 will not write partial UTF-8 sequences, preferring to stop before the end of the buffer.
Copies up to length characters into the output buffer. Only null-terminates if there is enough space in the buffer.
| buffer | The buffer into which the string will be copied. | |
| start | The starting position within the string at which copying begins. | |
| length | The number of characters to copy from the string. For WriteUtf8 the number of bytes in the buffer. | |
| nchars_ref | The number of characters written, can be NULL. | |
| options | Various options that might affect performance of this or subsequent operations. |
| V8EXPORT bool v8::String::CanMakeExternal | ( | ) |
Returns true if this string can be made external.
| static V8EXPORT Local<String> v8::String::Concat | ( | Handle< String > | left, | |
| Handle< String > | right | |||
| ) | [static] |
Creates a new string by concatenating the left and the right strings passed in as parameters.
| static V8EXPORT v8::Local<v8::String> v8::String::Empty | ( | ) | [static] |
A zero length string.
| V8EXPORT ExternalAsciiStringResource* v8::String::GetExternalAsciiStringResource | ( | ) | const |
Get the ExternalAsciiStringResource for an external ASCII string.
Returns NULL if IsExternalAscii() doesn't return true.
| String::ExternalStringResource * v8::String::GetExternalStringResource | ( | ) | const [inline] |
Get the ExternalStringResource for an external string.
Returns NULL if IsExternal() doesn't return true.
| V8EXPORT bool v8::String::IsExternal | ( | ) | const |
Returns true if the string is external.
Reimplemented from v8::Value.
| V8EXPORT bool v8::String::IsExternalAscii | ( | ) | const |
Returns true if the string is both external and ASCII.
| V8EXPORT int v8::String::Length | ( | ) | const |
Returns the number of characters in this string.
| V8EXPORT bool v8::String::MakeExternal | ( | ExternalStringResource * | resource | ) |
Associate an external string resource with this string by transforming it in place so that existing references to this string in the JavaScript heap will use the external string resource.
The external string resource's character contents need to be equivalent to this string. Returns true if the string has been changed to be an external string. The string is not modified if the operation fails. See NewExternal for information on the lifetime of the resource.
| V8EXPORT bool v8::String::MakeExternal | ( | ExternalAsciiStringResource * | resource | ) |
Associate an external string resource with this string by transforming it in place so that existing references to this string in the JavaScript heap will use the external string resource.
The external string resource's character contents need to be equivalent to this string. Returns true if the string has been changed to be an external string. The string is not modified if the operation fails. See NewExternal for information on the lifetime of the resource.
Allocates a new string from either UTF-8 encoded or ASCII data.
The second parameter 'length' gives the buffer length. If the data is UTF-8 encoded, the caller must be careful to supply the length parameter. If it is not given, the function calls 'strlen' to determine the buffer length, it might be wrong if 'data' contains a null character.
Referenced by v8::Template::Set().
Allocates a new string from 16-bit character codes.
| static V8EXPORT Local<String> v8::String::NewExternal | ( | ExternalStringResource * | resource | ) | [static] |
Creates a new external string using the data defined in the given resource.
When the external string is no longer live on V8's heap the resource will be disposed by calling its Dispose method. The caller of this function should not otherwise delete or modify the resource. Neither should the underlying buffer be deallocated or modified except through the destructor of the external string resource.
| static V8EXPORT Local<String> v8::String::NewExternal | ( | ExternalAsciiStringResource * | resource | ) | [static] |
Creates a new external string using the ASCII data defined in the given resource.
When the external string is no longer live on V8's heap the resource will be disposed by calling its Dispose method. The caller of this function should not otherwise delete or modify the resource. Neither should the underlying buffer be deallocated or modified except through the destructor of the external string resource.
Creates a symbol.
Returns one if it exists already.
| static V8EXPORT Local<String> v8::String::NewUndetectable | ( | const char * | data, | |
| int | length = -1 | |||
| ) | [static] |
Creates an undetectable string from the supplied ASCII or UTF-8 data.
| static V8EXPORT Local<String> v8::String::NewUndetectable | ( | const uint16_t * | data, | |
| int | length = -1 | |||
| ) | [static] |
Creates an undetectable string from the supplied 16-bit character codes.
| V8EXPORT int v8::String::Utf8Length | ( | ) | const |
Returns the number of bytes in the UTF-8 encoded representation of this string.
| V8EXPORT int v8::String::Write | ( | uint16_t * | buffer, | |
| int | start = 0, |
|||
| int | length = -1, |
|||
| int | options = NO_OPTIONS | |||
| ) | const |
| V8EXPORT int v8::String::WriteAscii | ( | char * | buffer, | |
| int | start = 0, |
|||
| int | length = -1, |
|||
| int | options = NO_OPTIONS | |||
| ) | const |
| V8EXPORT int v8::String::WriteUtf8 | ( | char * | buffer, | |
| int | length = -1, |
|||
| int * | nchars_ref = NULL, |
|||
| int | options = NO_OPTIONS | |||
| ) | const |
1.7.1