Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
jsdValue Class Reference

#include <jsd_xpc.h>

Inheritance diagram for jsdValue:
Inheritance graph
[legend]
Collaboration diagram for jsdValue:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_JSDIVALUE
NS_DECL_JSDIEPHEMERAL 
jsdValue (JSDContext *aCx, JSDValue *aValue)
virtual ~jsdValue ()
void getProperties ([array, size_is(length)] out jsdIProperty propArray, out unsigned long length)
 Retrieves all properties if this value represents an object.
jsdIProperty getProperty (in string name)
 Retrieves a single property from the value.
void refresh ()
 jsdIValues are wrappers around JavaScript engine structures.
void getWrappedValue ()
 When called from JavaScript, this method returns the JavaScript value wrapped by this jsdIValue.
void invalidate ()
 Mark this instance as invalid.

Static Public Member Functions

static jsdIValueFromPtr (JSDContext *aCx, JSDValue *aValue)
static void InvalidateAll ()

Public Attributes

readonly attribute JSDContext JSDContext
 Internal use only.
readonly attribute JSDValue JSDValue
 Internal use only.
readonly attribute boolean isNative
 |false| unless the value is a function declared in script.
readonly attribute boolean isNumber
 |true| if the value represents a number, either double or integer.
readonly attribute boolean isPrimitive
 |true| if the value represents a JavaScript primitive number or string
const unsigned long TYPE_BOOLEAN = 0
 Value is either |true| or |false|.
const unsigned long TYPE_DOUBLE = 1
 Value is a primitive number that is too large to fit in an integer.
const unsigned long TYPE_INT = 2
 Value is a primitive number that fits into an integer.
const unsigned long TYPE_FUNCTION = 3
 Value is a function.
const unsigned long TYPE_NULL = 4
 Value is |null|.
const unsigned long TYPE_OBJECT = 5
 Value is an object.
const unsigned long TYPE_STRING = 6
 Value is a primitive string.
const unsigned long TYPE_VOID = 7
 Value is void.
readonly attribute unsigned long jsType
 One of the TYPE_* values above.
readonly attribute jsdIValue jsPrototype
 Prototype value if this value represents an object, null if the value is not an object or the object has no prototype.
readonly attribute jsdIValue jsParent
 Parent value if this value represents an object, null if the value is not an object or the object has no parent.
readonly attribute string jsClassName
 Class name if this value represents an object.
readonly attribute jsdIValue jsConstructor
 Constructor name if this value represents an object.
readonly attribute string jsFunctionName
 Function name if this value represents a function.
readonly attribute boolean booleanValue
 Value if interpreted as a boolean.
readonly attribute double doubleValue
 Value if interpreted as a double.
readonly attribute long intValue
 Value if interpreted as an integer.
readonly attribute jsdIObject objectValue
 Value if interpreted as an object.
readonly attribute string stringValue
 Value if interpreted as a string.
readonly attribute long propertyCount
 Number of properties.
readonly attribute boolean isValid
 |true| if this object is still valid.

Private Member Functions

 jsdValue ()
 jsdValue (const jsdScript &)

Private Attributes

PRBool mValid
LiveEphemeral mLiveListEntry
JSDContextmCx
JSDValuemValue

Detailed Description

Definition at line 246 of file jsd_xpc.h.


Constructor & Destructor Documentation

jsdValue::jsdValue ( JSDContext aCx,
JSDValue aValue 
)

Definition at line 1958 of file jsd_xpc.cpp.

                                                     : mValid(PR_TRUE),
                                                         mCx(aCx), 
                                                         mValue(aValue)
{
    DEBUG_CREATE ("jsdValue", gValueCount);
    mLiveListEntry.value = this;
    jsds_InsertEphemeral (&gLiveValues, &mLiveListEntry);
}

Here is the call graph for this function:

jsdValue::~jsdValue ( ) [virtual]

Definition at line 1967 of file jsd_xpc.cpp.

{
    DEBUG_DESTROY ("jsdValue", gValueCount);
    if (mValid)
        /* call Invalidate() to take ourselves out of the live list */
        Invalidate();
}   
jsdValue::jsdValue ( ) [private]
jsdValue::jsdValue ( const jsdScript ) [private]

Member Function Documentation

jsdIValue * jsdValue::FromPtr ( JSDContext aCx,
JSDValue aValue 
) [static]

Definition at line 1946 of file jsd_xpc.cpp.

{
    /* value will be dropped by te jsdValue destructor. */

    if (!aValue)
        return nsnull;
    
    jsdIValue *rv = new jsdValue (aCx, aValue);
    NS_IF_ADDREF(rv);
    return rv;
}

Here is the caller graph for this function:

void jsdIValue::getProperties ( [array, size_is(length)] out jsdIProperty  propArray,
out unsigned long  length 
) [inherited]

Retrieves all properties if this value represents an object.

If this value is not an object a 0 element array is returned.

Parameters:
propArrayArray of jsdIProperty values for this value.
lengthSize of array.

Retrieves a single property from the value.

Only valid if the value represents an object.

Parameters:
nameName of the property to retrieve.
Return values:
jsdIPropertyfor the requested property name or null if no property exists for the requested name.

When called from JavaScript, this method returns the JavaScript value wrapped by this jsdIValue.

The calling script is free to use the result as it would any other JavaScript value. When called from another language this method returns an xpconnect defined error code.

Mark this instance as invalid.

Definition at line 1993 of file jsd_xpc.cpp.

Here is the call graph for this function:

void jsdIValue::refresh ( ) [inherited]

jsdIValues are wrappers around JavaScript engine structures.

Much of the data is copied instead of shared. The refresh method is used to resync the jsdIValue with the underlying structure.


Member Data Documentation

Value if interpreted as a boolean.

Converts if necessary.

Definition at line 1090 of file jsdIDebuggerService.idl.

readonly attribute double jsdIValue::doubleValue [inherited]

Value if interpreted as a double.

Converts if necessary.

Definition at line 1094 of file jsdIDebuggerService.idl.

readonly attribute long jsdIValue::intValue [inherited]

Value if interpreted as an integer.

Converts if necessary.

Definition at line 1098 of file jsdIDebuggerService.idl.

readonly attribute boolean jsdIValue::isNative [inherited]

|false| unless the value is a function declared in script.

Definition at line 1028 of file jsdIDebuggerService.idl.

readonly attribute boolean jsdIValue::isNumber [inherited]

|true| if the value represents a number, either double or integer.

|false| for all other values, including numbers assigned as strings (eg. x = "1";)

Definition at line 1034 of file jsdIDebuggerService.idl.

|true| if the value represents a JavaScript primitive number or string

Definition at line 1038 of file jsdIDebuggerService.idl.

|true| if this object is still valid.

If not, many or all of the methods and/or properties of the inheritor may no longer be callable.

Definition at line 691 of file jsdIDebuggerService.idl.

readonly attribute string jsdIValue::jsClassName [inherited]

Class name if this value represents an object.

Empty string if the value is not an object.

Definition at line 1075 of file jsdIDebuggerService.idl.

Constructor name if this value represents an object.

Empty string if the value is not an object.

Definition at line 1080 of file jsdIDebuggerService.idl.

Internal use only.

Definition at line 1021 of file jsdIDebuggerService.idl.

readonly attribute JSDValue jsdIValue::JSDValue [inherited]

Internal use only.

Definition at line 1023 of file jsdIDebuggerService.idl.

Function name if this value represents a function.

Empty string if the value is not a function.

Definition at line 1085 of file jsdIDebuggerService.idl.

readonly attribute jsdIValue jsdIValue::jsParent [inherited]

Parent value if this value represents an object, null if the value is not an object or the object has no parent.

Definition at line 1070 of file jsdIDebuggerService.idl.

Prototype value if this value represents an object, null if the value is not an object or the object has no prototype.

Definition at line 1065 of file jsdIDebuggerService.idl.

readonly attribute unsigned long jsdIValue::jsType [inherited]

One of the TYPE_* values above.

Definition at line 1060 of file jsdIDebuggerService.idl.

Definition at line 266 of file jsd_xpc.h.

Definition at line 265 of file jsd_xpc.h.

Definition at line 264 of file jsd_xpc.h.

Definition at line 267 of file jsd_xpc.h.

Value if interpreted as an object.

Definition at line 1102 of file jsdIDebuggerService.idl.

readonly attribute long jsdIValue::propertyCount [inherited]

Number of properties.

0 if the value is not an object, or the value is an object but has no properties.

Definition at line 1112 of file jsdIDebuggerService.idl.

readonly attribute string jsdIValue::stringValue [inherited]

Value if interpreted as a string.

Converts if necessary.

Definition at line 1106 of file jsdIDebuggerService.idl.

const unsigned long jsdIValue::TYPE_BOOLEAN = 0 [inherited]

Value is either |true| or |false|.

Definition at line 1041 of file jsdIDebuggerService.idl.

const unsigned long jsdIValue::TYPE_DOUBLE = 1 [inherited]

Value is a primitive number that is too large to fit in an integer.

Definition at line 1043 of file jsdIDebuggerService.idl.

const unsigned long jsdIValue::TYPE_FUNCTION = 3 [inherited]

Value is a function.

Definition at line 1047 of file jsdIDebuggerService.idl.

const unsigned long jsdIValue::TYPE_INT = 2 [inherited]

Value is a primitive number that fits into an integer.

Definition at line 1045 of file jsdIDebuggerService.idl.

const unsigned long jsdIValue::TYPE_NULL = 4 [inherited]

Value is |null|.

Definition at line 1049 of file jsdIDebuggerService.idl.

const unsigned long jsdIValue::TYPE_OBJECT = 5 [inherited]

Value is an object.

Definition at line 1051 of file jsdIDebuggerService.idl.

const unsigned long jsdIValue::TYPE_STRING = 6 [inherited]

Value is a primitive string.

Definition at line 1053 of file jsdIDebuggerService.idl.

const unsigned long jsdIValue::TYPE_VOID = 7 [inherited]

Value is void.

Definition at line 1055 of file jsdIDebuggerService.idl.


The documentation for this class was generated from the following files: