beautypg.com

Jsbool js_stringtovalue(), Jsbool js_ucstringtovalue() – Adobe Extending Dreamweaver CS4 User Manual

Page 359

background image

353

EXTENDING DREAMWEAVER CS4

C-level extensibility

The

*pLength

argument is a pointer to an unsigned integer. This function sets

*pLength

equal to the length of the

string in bytes.

Returns
A pointer that points to a null-terminated UTF-8 string if successful, or to a

null

value on failure. The calling routine

must not free this string when it finishes.

JSBool JS_StringToValue()

Description
This function stores a string return value in a JSVal structure. It allocates a new JavaScript string object.

Arguments
JSContext

*cx

, JSVal

*bytes

, size_t sz, JSVal

*vp

The

*cx

argument is the opaque JSContext pointer that passes to the JavaScript function.

The

bytes

argument is the string that Dreamweaver stores in the JSVal structure. The string data is copied, so the

caller must free the string when it is not needed. If the string size is not specified (see the

sz

argument), the string

must be null-terminated.

The

sz

argument is the size of the string, in bytes. If

sz

is

0

, the length of the null-terminated string is computed

automatically.

The

*vp

argument is a pointer to the JSVal structure into which the contents of the string is copied.

Returns
A Boolean value:

JS_TRUE

indicates success;

JS_FALSE

indicates failure.

JSBool JS_UCStringToValue()

Description
This function stores a string return value in a

JSVal

structure. It allocates a new JavaScript string object.

Arguments
JSContext

*cx

, JSVal

*bytes

,

size_tsz

, JSVal

*vp

The

*cx

argument is the opaque JSContext pointer that passes to the JavaScript function.

The

*bytes

argument is the string that Dreamweaver stores in the JSVal structure. The string data is copied, so the

caller must free the string when it is not needed. If the string size is not specified (see the

sz

argument), the string

must be null-terminated.

The

sz

argument is the size of the string, in bytes. If

sz

is

0

, the length of the null-terminated string is computed

automatically.

The

*vp

argument is a pointer to the JSVal structure into which the contents of the string is copied.

Returns
A Boolean value:

JS_TRUE

indicates success;

JS_FALSE

indicates failure

This manual is related to the following products: