.TH "KJS::Object" 3 "28 Jan 2004" "kjs Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KJS::Object \- Represents an \fBObject\fP.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <object.h>\fP
.PP
Inherits \fBKJS::Value\fP.
.PP
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBObject\fP (ObjectImp *v)"
.br
.ti -1c
.RI "\fBObject\fP (const  \fBObject\fP &v)"
.br
.ti -1c
.RI "\fBObject\fP & \fBoperator=\fP (const  \fBObject\fP &v)"
.br
.ti -1c
.RI "virtual const  \fBClassInfo\fP * \fBclassInfo\fP () const "
.br
.ti -1c
.RI "bool \fBinherits\fP (const  \fBClassInfo\fP *cinfo) const "
.br
.ti -1c
.RI "\fBValue\fP \fBprototype\fP () const "
.br
.RI "\fIReturns the prototype of this object. \fP"
.ti -1c
.RI "\fBUString\fP \fBclassName\fP () const "
.br
.RI "\fIReturns the class name of the object. \fP"
.ti -1c
.RI "\fBValue\fP \fBget\fP (\fBExecState\fP *exec, const  \fBUString\fP &propertyName) const "
.br
.RI "\fIRetrieves the specified property from the object. \fP"
.ti -1c
.RI "void \fBput\fP (\fBExecState\fP *exec, const  \fBUString\fP &propertyName, const  \fBValue\fP &value, int attr=None)"
.br
.RI "\fISets the specified property. \fP"
.ti -1c
.RI "bool \fBcanPut\fP (\fBExecState\fP *exec, const  \fBUString\fP &propertyName) const "
.br
.RI "\fIUsed to check whether or not a particular property is allowed to be set on an object. \fP"
.ti -1c
.RI "bool \fBhasProperty\fP (\fBExecState\fP *exec, const  \fBUString\fP &propertyName) const "
.br
.RI "\fIChecks to see whether the object (or any object in it's prototype chain) has a property with the specified name. \fP"
.ti -1c
.RI "bool \fBdeleteProperty\fP (\fBExecState\fP *exec, const  \fBUString\fP &propertyName)"
.br
.RI "\fIRemoves the specified property from the object. \fP"
.ti -1c
.RI "\fBValue\fP \fBdefaultValue\fP (\fBExecState\fP *exec, Type hint) const "
.br
.RI "\fIConverts the object into a primitive value. \fP"
.ti -1c
.RI "bool \fBimplementsConstruct\fP () const "
.br
.RI "\fIWhether or not the object implements the \fBconstruct()\fP method. \fP"
.ti -1c
.RI "\fBObject\fP \fBconstruct\fP (\fBExecState\fP *exec, const  \fBList\fP &args)"
.br
.RI "\fICreates a new object based on this object. \fP"
.ti -1c
.RI "bool \fBimplementsCall\fP () const "
.br
.RI "\fIWhether or not the object implements the \fBcall()\fP method. \fP"
.ti -1c
.RI "\fBValue\fP \fBcall\fP (\fBExecState\fP *exec, \fBObject\fP &thisObj, const  \fBList\fP &args)"
.br
.RI "\fICalls this object as if it is a function. \fP"
.ti -1c
.RI "bool \fBimplementsHasInstance\fP () const "
.br
.RI "\fIWhether or not the object implements the \fBhasInstance()\fP method. \fP"
.ti -1c
.RI "\fBBoolean\fP \fBhasInstance\fP (\fBExecState\fP *exec, const  \fBValue\fP &value)"
.br
.RI "\fIChecks whether value delegates behaviour to this object. \fP"
.ti -1c
.RI "const  \fBList\fP \fBscope\fP () const "
.br
.RI "\fIReturns the scope of this object. \fP"
.ti -1c
.RI "void \fBsetScope\fP (const  \fBList\fP &s)"
.br
.ti -1c
.RI "\fBList\fP \fBpropList\fP (\fBExecState\fP *exec, bool recursive=true)"
.br
.RI "\fIReturns a \fBList\fP of References to all the properties of the object. \fP"
.ti -1c
.RI "\fBValue\fP \fBinternalValue\fP () const "
.br
.RI "\fIReturns the internal value of the object. \fP"
.ti -1c
.RI "void \fBsetInternalValue\fP (const  \fBValue\fP &v)"
.br
.RI "\fISets the internal value of the object. \fP"
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "\fBObject\fP \fBdynamicCast\fP (const  \fBValue\fP &v)"
.br
.RI "\fIConverts a \fBValue\fP into an \fBObject\fP. \fP"
.in -1c
.SH "Detailed Description"
.PP 
Represents an \fBObject\fP. 

This is a wrapper for ObjectImp 
.PP
Definition at line 76 of file object.h.
.SH "Member Function Documentation"
.PP 
.SS "\fBObject\fP Object::dynamicCast (const \fBValue\fP & v)\fC [static]\fP"
.PP
Converts a \fBValue\fP into an \fBObject\fP. 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 \fBisNull\fP() methods afterwards before calling any methods on the \fBObject\fP.
.PP
\fBReturns:\fP
.RS 4
The value converted to an object 
.RE
.PP
Definition at line 77 of file object.cpp.
.PP
References KJS::Value::imp(), KJS::Value::isNull(), and KJS::Value::type().
.SS "\fBValue\fP Object::prototype () const"
.PP
Returns the prototype of this object. Note that this is not the same as the 'prototype' property.
.PP
See ECMA 8.6.2
.PP
\fBReturns:\fP
.RS 4
The object's prototype 
.RE
.PP
Definition at line 85 of file object.cpp.
.SS "\fBUString\fP Object::className () const"
.PP
Returns the class name of the object. See ECMA 8.6.2
.PP
\fBReturns:\fP
.RS 4
The object's class name 
.RE
.PP
Definition at line 90 of file object.cpp.
.SS "\fBValue\fP Object::get (\fBExecState\fP * exec, const \fBUString\fP & propertyName) const"
.PP
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 \fBUndefined\fP.
.PP
See ECMA 8.6.2.1
.PP
\fBParameters:\fP
.RS 4
\fIexec\fP The current execution state 
.br
\fIpropertyName\fP The name of the property to retrieve
.RE
.PP
\fBReturns:\fP
.RS 4
The specified property, or \fBUndefined\fP 
.RE
.PP
Definition at line 95 of file object.cpp.
.SS "void Object::put (\fBExecState\fP * exec, const \fBUString\fP & propertyName, const \fBValue\fP & value, int attr = None)"
.PP
Sets the specified property. See ECMA 8.6.2.2
.PP
\fBParameters:\fP
.RS 4
\fIexec\fP The current execution state 
.br
\fIpropertyName\fP The name of the property to set 
.br
\fIpropertyValue\fP The value to set 
.RE
.PP
Definition at line 100 of file object.cpp.
.PP
Referenced by KJS::Error::create().
.SS "bool Object::canPut (\fBExecState\fP * exec, const \fBUString\fP & propertyName) const"
.PP
Used to check whether or not a particular property is allowed to be set on an object. See ECMA 8.6.2.3
.PP
\fBParameters:\fP
.RS 4
\fIexec\fP The current execution state 
.br
\fIpropertyName\fP The name of the property 
.RE
.PP
\fBReturns:\fP
.RS 4
true if the property can be set, otherwise false 
.RE
.PP
Definition at line 105 of file object.cpp.
.SS "bool Object::hasProperty (\fBExecState\fP * exec, const \fBUString\fP & propertyName) const"
.PP
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
.PP
\fBParameters:\fP
.RS 4
\fIexec\fP The current execution state 
.br
\fIpropertyName\fP The name of the property to check for 
.RE
.PP
\fBReturns:\fP
.RS 4
true if the object has the property, otherwise false 
.RE
.PP
Definition at line 110 of file object.cpp.
.SS "bool Object::deleteProperty (\fBExecState\fP * exec, const \fBUString\fP & propertyName)"
.PP
Removes the specified property from the object. See ECMA 8.6.2.5
.PP
\fBParameters:\fP
.RS 4
\fIexec\fP The current execution state 
.br
\fIpropertyName\fP The name of the property to delete 
.RE
.PP
\fBReturns:\fP
.RS 4
true if the property was successfully deleted or did not exist on the object. false if deleting the specified property is not allowed. 
.RE
.PP
Definition at line 115 of file object.cpp.
.SS "\fBValue\fP Object::defaultValue (\fBExecState\fP * exec, Type hint) const"
.PP
Converts the object into a primitive value. The value return may differ depending on the supplied hint
.PP
See ECMA 8.6.2.6
.PP
\fBParameters:\fP
.RS 4
\fIexec\fP The current execution state 
.br
\fIhint\fP The desired primitive type to convert to 
.RE
.PP
\fBReturns:\fP
.RS 4
A primitive value converted from the objetc. Note that the type of primitive value returned may not be the same as the requested hint. 
.RE
.PP
Definition at line 120 of file object.cpp.
.SS "bool Object::implementsConstruct () const"
.PP
Whether or not the object implements the \fBconstruct()\fP method. If this returns false you should not call the \fBconstruct()\fP method on this object (typically, an assertion will fail to indicate this).
.PP
\fBReturns:\fP
.RS 4
true if this object implements the \fBconstruct()\fP method, otherwise false 
.RE
.PP
Definition at line 125 of file object.cpp.
.SS "\fBObject\fP Object::construct (\fBExecState\fP * exec, const \fBList\fP & args)"
.PP
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 \fBcall()\fP method of this object is called, with the new object passed as the this value 4. The new object is returned
.PP
In some cases, Host objects may differ from these semantics, although this is discouraged.
.PP
If an error occurs during construction, the execution state's exception will be set. This can be tested for with \fBExecState::hadException\fP(). Under some circumstances, the exception object may also be returned.
.PP
Note: This function should not be called if \fBimplementsConstruct()\fP returns false, in which case it will result in an assertion failure.
.PP
\fBParameters:\fP
.RS 4
\fIexec\fP The current execution state 
.br
\fIargs\fP The arguments to be passed to \fBcall()\fP once the new object has been created 
.RE
.PP
\fBReturns:\fP
.RS 4
The newly created & initialized object 
.RE
.PP
Definition at line 130 of file object.cpp.
.PP
Referenced by KJS::Error::create().
.SS "bool Object::implementsCall () const"
.PP
Whether or not the object implements the \fBcall()\fP method. If this returns false you should not call the \fBcall()\fP method on this object (typically, an assertion will fail to indicate this).
.PP
\fBReturns:\fP
.RS 4
true if this object implements the \fBcall()\fP method, otherwise false 
.RE
.PP
Definition at line 135 of file object.cpp.
.SS "\fBValue\fP Object::call (\fBExecState\fP * exec, \fBObject\fP & thisObj, const \fBList\fP & args)"
.PP
Calls this object as if it is a function. Note: This function should not be called if \fBimplementsCall()\fP returns false, in which case it will result in an assertion failure.
.PP
See ECMA 8.6.2.3
.PP
\fBParameters:\fP
.RS 4
\fIexec\fP The current execution state 
.br
\fIthisObj\fP 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, \fBcall()\fP will be invoked on the C++ object which implements the toString method, with the thisObj being window.location 
.br
\fIargs\fP \fBList\fP of arguments to be passed to the function 
.RE
.PP
\fBReturns:\fP
.RS 4
The return value from the function 
.RE
.PP
Definition at line 140 of file object.cpp.
.PP
References KJS::ExecState::setException().
.SS "bool Object::implementsHasInstance () const"
.PP
Whether or not the object implements the \fBhasInstance()\fP method. If this returns false you should not call the \fBhasInstance()\fP method on this object (typically, an assertion will fail to indicate this).
.PP
\fBReturns:\fP
.RS 4
true if this object implements the \fBhasInstance()\fP method, otherwise false 
.RE
.PP
Definition at line 164 of file object.cpp.
.SS "\fBBoolean\fP Object::hasInstance (\fBExecState\fP * exec, const \fBValue\fP & value)"
.PP
Checks whether value delegates behaviour to this object. Used by the instanceof operator.
.PP
\fBParameters:\fP
.RS 4
\fIexec\fP The current execution state 
.br
\fIvalue\fP The value to check 
.RE
.PP
\fBReturns:\fP
.RS 4
true if value delegates behaviour to this object, otherwise false 
.RE
.PP
Definition at line 169 of file object.cpp.
.SS "const  \fBList\fP Object::scope () const"
.PP
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:
.PP
function f() {
.PP
function b() { return prototype; }
.PP
var x = 4; // do some stuff } f.prototype = new String();
.PP
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 \fBString\fP object that was assigned to f.prototype.
.PP
\fBParameters:\fP
.RS 4
\fIexec\fP The current execution state 
.RE
.PP
\fBReturns:\fP
.RS 4
The function's scope 
.RE
.PP
Definition at line 174 of file object.cpp.
.SS "\fBList\fP Object::propList (\fBExecState\fP * exec, bool recursive = true)"
.PP
Returns a \fBList\fP 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.
.PP
Subclasses can override this method in ObjectImpl to provide the appearance of having extra properties other than those set specifically with \fBput()\fP.
.PP
\fBParameters:\fP
.RS 4
\fIexec\fP The current execution state 
.br
\fIrecursive\fP Whether or not properties in the object's prototype chain should be included in the list. 
.RE
.PP
\fBReturns:\fP
.RS 4
A \fBList\fP of References to properties of the object. 
.RE
.PP
Definition at line 184 of file object.cpp.
.SS "\fBValue\fP Object::internalValue () const"
.PP
Returns the internal value of the object. This is used for objects such as \fBString\fP and \fBBoolean\fP which are wrappers for native types. The interal value is the actual value represented by the wrapper objects.
.PP
\fBSee also:\fP
.RS 4
ECMA 8.6.2 
.RE
.PP
\fBReturns:\fP
.RS 4
The internal value of the object 
.RE
.PP
Definition at line 189 of file object.cpp.
.SS "void Object::setInternalValue (const \fBValue\fP & v)"
.PP
Sets the internal value of the object. \fBSee also:\fP
.RS 4
\fBinternalValue()\fP
.RE
.PP
\fBParameters:\fP
.RS 4
\fIv\fP The new internal value 
.RE
.PP
Definition at line 194 of file object.cpp.

.SH "Author"
.PP 
Generated automatically by Doxygen for kjs Library from the source code.
