KJS::ObjectImp Class Reference

Inheritance diagram for KJS::ObjectImp:

KJS::ValueImp KJS::ActivationImp KJS::ArgumentsImp KJS::ArrayInstanceImp KJS::BooleanInstanceImp KJS::DateInstanceImp KJS::ErrorInstanceImp KJS::ErrorPrototypeImp KJS::InternalFunctionImp KJS::MathObjectImp KJS::NativeErrorPrototypeImp KJS::NumberInstanceImp KJS::ObjectPrototypeImp KJS::RegExpImp KJS::RegExpPrototypeImp KJS::StringInstanceImp List of all members.

Detailed Description

Definition at line 361 of file object.h.


Public Member Functions

 ObjectImp (const Object &proto)
 ObjectImp (ObjectImp *proto)
 ObjectImp ()
virtual ~ObjectImp ()
virtual void mark ()
Type type () const
virtual const ClassInfoclassInfo () const
bool inherits (const ClassInfo *cinfo) const
Value prototype () const
void setPrototype (const Value &proto)
virtual UString className () const
virtual Value get (ExecState *exec, const Identifier &propertyName) const
virtual Value getPropertyByIndex (ExecState *exec, unsigned propertyName) const
virtual void put (ExecState *exec, const Identifier &propertyName, const Value &value, int attr=None)
virtual void putPropertyByIndex (ExecState *exec, unsigned propertyName, const Value &value, int attr=None)
virtual bool canPut (ExecState *exec, const Identifier &propertyName) const
virtual bool hasProperty (ExecState *exec, const Identifier &propertyName) const
virtual bool hasPropertyByIndex (ExecState *exec, unsigned propertyName) const
virtual bool deleteProperty (ExecState *exec, const Identifier &propertyName)
virtual bool deletePropertyByIndex (ExecState *exec, unsigned propertyName)
void deleteAllProperties (ExecState *)
virtual Value defaultValue (ExecState *exec, Type hint) const
virtual bool implementsConstruct () const
virtual Object construct (ExecState *exec, const List &args)
virtual bool implementsCall () const
virtual Value call (ExecState *exec, Object &thisObj, const List &args)
virtual bool implementsHasInstance () const
virtual Boolean hasInstance (ExecState *exec, const Value &value)
const ScopeChainscope () const
void setScope (const ScopeChain &s)
virtual ReferenceList propList (ExecState *exec, bool recursive=true)
Value internalValue () const
void setInternalValue (const Value &v)
void setInternalValue (ValueImp *v)
Value toPrimitive (ExecState *exec, Type preferredType=UnspecifiedType) const
bool toBoolean (ExecState *exec) const
double toNumber (ExecState *exec) const
UString toString (ExecState *exec) const
Object toObject (ExecState *exec) const
ValueImpgetDirect (const Identifier &propertyName) const
void putDirect (const Identifier &propertyName, ValueImp *value, int attr=0)
void putDirect (const Identifier &propertyName, int value, int attr=0)
void setFunctionName (const Identifier &propertyName)

Protected Attributes

PropertyMap _prop

Friends

class ObjectProtoFuncImp

Constructor & Destructor Documentation

ObjectImp::ObjectImp ( const Object proto  ) 

Creates a new ObjectImp with the specified prototype.

Parameters:
proto The prototype

Definition at line 84 of file object.cpp.

ObjectImp::ObjectImp (  ) 

Creates a new ObjectImp with a prototype of Null() (that is, the ECMAScript "null" value, not a null Object).

Definition at line 95 of file object.cpp.


Member Function Documentation

const ClassInfo * ObjectImp::classInfo (  )  const [virtual]

A pointer to a ClassInfo struct for this class.

This provides a basic facility for run-time type information, and can be used to check an object's class an inheritance (see inherits()). This should always return a statically declared pointer, or 0 to indicate that there is no class information.

This is primarily useful if you have application-defined classes that you wish to check against for casting purposes.

For example, to specify the class info for classes FooImp and BarImp, where FooImp inherits from BarImp, you would add the following in your class declarations:

   class BarImp : public ObjectImp {
     virtual const ClassInfo *classInfo() const { return &info; }
     static const ClassInfo info;
     // ...
   };

   class FooImp : public ObjectImp {
     virtual const ClassInfo *classInfo() const { return &info; }
     static const ClassInfo info;
     // ...
   };

And in your source file:

   const ClassInfo BarImp::info = {0, 0, 0}; // no parent class
   const ClassInfo FooImp::info = {&BarImp::info, 0, 0};

See also:
inherits()

Reimplemented in KJS::ArrayInstanceImp, KJS::ArrayPrototypeImp, KJS::BooleanInstanceImp, KJS::DateInstanceImp, KJS::DatePrototypeImp, KJS::ErrorInstanceImp, KJS::NativeErrorImp, KJS::InternalFunctionImp, KJS::FunctionImp, KJS::DeclaredFunctionImp, KJS::ArgumentsImp, KJS::ActivationImp, KJS::MathObjectImp, KJS::NumberInstanceImp, KJS::NumberObjectImp, KJS::RegExpPrototypeImp, KJS::RegExpImp, KJS::StringInstanceImp, and KJS::StringPrototypeImp.

Definition at line 123 of file object.cpp.

bool ObjectImp::inherits ( const ClassInfo cinfo  )  const

Checks whether this object inherits from the class with the specified classInfo() pointer.

This requires that both this class and the other class return a non-NULL pointer for their classInfo() methods (otherwise it will return false).

For example, for two ObjectImp pointers obj1 and obj2, you can check if obj1's class inherits from obj2's class using the following:

if (obj1->inherits(obj2->classInfo())) { // ... }

If you have a handle to a statically declared ClassInfo, such as in the classInfo() example, you can check for inheritance without needing an instance of the other class:

if (obj1->inherits(FooImp::info)) { // ... }

Parameters:
cinfo The ClassInfo pointer for the class you want to check inheritance against.
Returns:
true if this object's class inherits from class with the ClassInfo pointer specified in cinfo

Definition at line 128 of file object.cpp.

Value ObjectImp::prototype (  )  const

Implementation of the [[Prototype]] internal property (implemented by all Objects).

See also:
Object::prototype()

Definition at line 148 of file object.cpp.

UString ObjectImp::className (  )  const [virtual]

Implementation of the [[Class]] internal property (implemented by all Objects).

The default implementation uses classInfo(). You should either implement classInfo(), or if you simply need a classname, you can reimplement className() instead.

See also:
Object::className()

Definition at line 158 of file object.cpp.

Value ObjectImp::get ( ExecState exec,
const Identifier propertyName 
) const [virtual]

void ObjectImp::put ( ExecState exec,
const Identifier propertyName,
const Value value,
int  attr = None 
) [virtual]

Implementation of the [[Put]] internal property (implemented by all Objects).

See also:
Object::put()

Reimplemented in KJS::ArrayInstanceImp, KJS::FunctionImp, KJS::ArgumentsImp, and KJS::StringInstanceImp.

Definition at line 195 of file object.cpp.

bool ObjectImp::canPut ( ExecState exec,
const Identifier propertyName 
) const [virtual]

Implementation of the [[CanPut]] internal property (implemented by all Objects).

See also:
Object::canPut()

Definition at line 229 of file object.cpp.

bool ObjectImp::hasProperty ( ExecState exec,
const Identifier propertyName 
) const [virtual]

Implementation of the [[HasProperty]] internal property (implemented by all Objects).

See also:
Object::hasProperty()

Reimplemented in KJS::ArrayInstanceImp, KJS::FunctionImp, KJS::ActivationImp, KJS::RegExpObjectImp, and KJS::StringInstanceImp.

Definition at line 247 of file object.cpp.

bool ObjectImp::deleteProperty ( ExecState exec,
const Identifier propertyName 
) [virtual]

Implementation of the [[Delete]] internal property (implemented by all Objects).

See also:
Object::deleteProperty()

Reimplemented in KJS::ArrayInstanceImp, KJS::FunctionImp, KJS::ActivationImp, and KJS::StringInstanceImp.

Definition at line 271 of file object.cpp.

void ObjectImp::deleteAllProperties ( ExecState  ) 

Remove all properties from this object.

This doesn't take DontDelete into account, and isn't in the ECMA spec. It's simply a quick way to remove everything before destroying.

Definition at line 294 of file object.cpp.

Value ObjectImp::defaultValue ( ExecState exec,
Type  hint 
) const [virtual]

Implementation of the [[DefaultValue]] internal property (implemented by all Objects).

See also:
Object::defaultValue()

Definition at line 300 of file object.cpp.

Object ObjectImp::construct ( ExecState exec,
const List args 
) [virtual]

Boolean ObjectImp::hasInstance ( ExecState exec,
const Value value 
) [virtual]

Implementation of the [[HasInstance]] internal property.

See also:
Object::hasInstance()

Reimplemented in KJS::InternalFunctionImp.

Definition at line 395 of file object.cpp.

const ScopeChain& KJS::ObjectImp::scope (  )  const [inline]

Implementation of the [[Scope]] internal property.

See also:
Object::scope()

Definition at line 571 of file object.h.

ReferenceList ObjectImp::propList ( ExecState exec,
bool  recursive = true 
) [virtual]

Reimplemented in KJS::ArrayInstanceImp, and KJS::StringInstanceImp.

Definition at line 401 of file object.cpp.

void ObjectImp::setFunctionName ( const Identifier propertyName  ) 

Sets the name of the function, if this is an InternalFunctionImp object.

(calling InternalFunctionImp::setName)

Definition at line 484 of file object.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys