|
|
Represents an Object. This is a wrapper for ObjectImp
Object ()
| Object |
explicit Object (ObjectImp *v)
| Object |
Object (const Object &v)
| Object |
~Object ()
| ~Object |
[virtual]
Object& operator= (const Object &v)
| operator= |
Reimplemented from Value.
const ClassInfo * classInfo ()
| classInfo |
[const virtual]
bool inherits (const ClassInfo *cinfo)
| inherits |
[const]
Object dynamicCast (const Value &v)
| dynamicCast |
[static]
Converts a Value into an Object. If the value's type is not ObjectType, a null object will be returned (i.e. one with it's internal pointer set to 0). If you do not know for sure whether the value is of type ObjectType, you should check the isNull() methods afterwards before calling any methods on the Object.
Returns: The value converted to an object
Value prototype ()
| prototype |
[const]
Returns the prototype of this object. Note that this is not the same as the "prototype" property.
See ECMA 8.6.2
Returns: The object's prototype
UString className ()
| className |
[const]
Returns the class name of the object
See ECMA 8.6.2
Returns: The object's class name
Value get (ExecState *exec, const UString &propertyName)
| get |
[const]
Retrieves the specified property from the object. If neither the object or any other object in it's prototype chain have the property, this function will return Undefined.
See ECMA 8.6.2.1
Parameters:
exec | The current execution state |
propertyName | The name of the property to retrieve |
Returns: The specified property, or Undefined
void put (ExecState *exec, const UString &propertyName,
const Value &value, int attr = None)
| put |
Sets the specified property.
See ECMA 8.6.2.2
Parameters:
exec | The current execution state |
propertyName | The name of the property to set |
propertyValue | The value to set |
bool canPut (ExecState *exec, const UString &propertyName)
| canPut |
[const]
Used to check whether or not a particular property is allowed to be set on an object
See ECMA 8.6.2.3
Parameters:
exec | The current execution state |
propertyName | The name of the property |
Returns: true if the property can be set, otherwise false
bool hasProperty (ExecState *exec, const UString &propertyName)
| hasProperty |
[const]
Checks to see whether the object (or any object in it's prototype chain) has a property with the specified name.
See ECMA 8.6.2.4
Parameters:
exec | The current execution state |
propertyName | The name of the property to check for |
Returns: true if the object has the property, otherwise false
bool deleteProperty (ExecState *exec, const UString &propertyName)
| deleteProperty |
Removes the specified property from the object.
See ECMA 8.6.2.5
Parameters:
exec | The current execution state |
propertyName | The name of the property to delete |
Returns: true if the property was successfully deleted or did not exist on the object. false if deleting the specified property is not allowed.
Value defaultValue (ExecState *exec, Type hint)
| defaultValue |
[const]
Converts the object into a primitive value. The value return may differ depending on the supplied hint
See ECMA 8.6.2.6
Parameters:
exec | The current execution state |
hint | The desired primitive type to convert to |
Returns: A primitive value converted from the objetc. Note that the type of primitive value returned may not be the same as the requested hint.
bool implementsConstruct ()
| implementsConstruct |
[const]
Whether or not the object implements the construct() method. If this returns false you should not call the construct() method on this object (typically, an assertion will fail to indicate this).
Returns: true if this object implements the construct() method, otherwise false
Object construct (ExecState *exec, const List &args)
| construct |
Creates a new object based on this object. Typically this means the following: 1. A new object is created 2. The prototype of the new object is set to the value of this object's "prototype" property 3. The call() method of this object is called, with the new object passed as the this value 4. The new object is returned
In some cases, Host objects may differ from these semantics, although this is discouraged.
If an error occurs during construction, the execution state's exception will be set. This can be tested for with ExecState::hadException(). Under some circumstances, the exception object may also be returned.
Note: This function should not be called if implementsConstruct() returns false, in which case it will result in an assertion failure.
Parameters:
exec | The current execution state |
args | The arguments to be passed to call() once the new object has been created |
Returns: The newly created & initialized object
bool implementsCall ()
| implementsCall |
[const]
Whether or not the object implements the call() method. If this returns false you should not call the call() method on this object (typically, an assertion will fail to indicate this).
Returns: true if this object implements the call() method, otherwise false
Value call (ExecState *exec, Object &thisObj, const List &args)
| call |
Calls this object as if it is a function.
Note: This function should not be called if implementsCall() returns false, in which case it will result in an assertion failure.
See ECMA 8.6.2.3
Parameters:
exec | The current execution state |
thisObj | The obj to be used as "this" within function execution. Note that in most cases this will be different from the C++ "this" object. For example, if the ECMAScript code "window.location.toString()" is executed, call() will be invoked on the C++ object which implements the toString method, with the thisObj being window.location |
args | List of arguments to be passed to the function |
Returns: The return value from the function
bool implementsHasInstance ()
| implementsHasInstance |
[const]
Whether or not the object implements the hasInstance() method. If this returns false you should not call the hasInstance() method on this object (typically, an assertion will fail to indicate this).
Returns: true if this object implements the hasInstance() method, otherwise false
Boolean hasInstance (ExecState *exec, const Value &value)
| hasInstance |
Checks whether value delegates behaviour to this object. Used by the instanceof operator.
Parameters:
exec | The current execution state |
value | The value to check |
Returns: true if value delegates behaviour to this object, otherwise false
const List scope ()
| scope |
[const]
Returns the scope of this object. This is used when execution declared functions - the execution context for the function is initialized with extra object in it's scope. An example of this is functions declared inside other functions:
function f() {
function b() { return prototype; }
var x = 4; // do some stuff } f.prototype = new String();
When the function f.b is executed, its scope will include properties of f. So in the example above the return value of f.b() would be the new String object that was assigned to f.prototype.
Parameters:
exec | The current execution state |
Returns: The function's scope
void setScope (const List &s)
| setScope |
List propList (ExecState *exec, bool recursive = true)
| propList |
Returns a List of References to all the properties of the object. Used in "for x in y" statements. The list is created new, so it can be freely modified without affecting the object's properties. It should be deleted by the caller.
Subclasses can override this method in ObjectImpl to provide the appearance of having extra properties other than those set specifically with put().
Parameters:
exec | The current execution state |
recursive | Whether or not properties in the object's prototype chain should be included in the list. |
Returns: A List of References to properties of the object.
Value internalValue ()
| internalValue |
[const]
Returns the internal value of the object. This is used for objects such as String and Boolean which are wrappers for native types. The interal value is the actual value represented by the wrapper objects.
Returns: The internal value of the object
See also: ECMA, 8.6.2
void setInternalValue (const Value &v)
| setInternalValue |
Sets the internal value of the object
Parameters:
v | The new internal value |
See also: internalValue()
Generated by: dfaure on faure on Tue Apr 16 08:50:27 2002, using kdoc 2.0a53. |