class ObjectImp

# class ObjectImp |
Full name | `KJS::ObjectImp`
Definition | `#include <object.h>`
Inherits | KJS::ValueImp [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- ObjectImp (const Object &proto)
- ObjectImp ()
- virtual ~ObjectImp ()
- virtual void mark ()
- Type type () const
- virtual const ClassInfo * classInfo () 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 UString &propertyName) const
- virtual void put (ExecState *exec, const UString &propertyName, const Value &value, int attr = None)
- virtual bool canPut (ExecState *exec, const UString &propertyName) const
- virtual bool hasProperty (ExecState *exec, const UString &propertyName) const
- virtual bool deleteProperty (ExecState *exec, const UString &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 List scope () const
- void setScope (const List &s)
- List propList (ExecState *exec, bool recursive = true)
- Value internalValue () const
- void setInternalValue (const Value &v)
- Value toPrimitive (ExecState *exec, Type preferredType = UnspecifiedType) const
- bool toBoolean (ExecState *exec) const
- double toNumber (ExecState *exec) const
- int toInteger (ExecState *exec) const
- int toInt32 (ExecState *exec) const
- unsigned int toUInt32 (ExecState *exec) const
- unsigned short toUInt16 (ExecState *exec) const
- UString toString (ExecState *exec) const
- Object toObject (ExecState *exec) const
- ValueImp* getDirect (const UString& propertyName) const

## Detailed Description

ObjectImp (const Object &proto) | ### ObjectImp

Creates a new ObjectImp with the specified prototype

Parameters:

proto | The prototype

ObjectImp () | ### ObjectImp

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

~ObjectImp () | ### ~ObjectImp

[virtual]

void mark () | ### mark

[virtual]

Reimplemented from ValueImp.

Type type () | ### type

[const]

Reimplemented from ValueImp.

const ClassInfo * classInfo () | ### 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()

bool inherits (const ClassInfo *cinfo) | ### inherits

[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

Value prototype () | ### prototype

[const]

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

See also: Object::prototype()

void setPrototype (const Value &proto) | ### setPrototype

UString className () | ### 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()

Value get (ExecState *exec, const UString &propertyName) | ### get

[const virtual]

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

See also: Object::get()

void put (ExecState *exec, const UString &propertyName, const Value &value, int attr = None) | ### put

[virtual]

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

See also: Object::put()

bool canPut (ExecState *exec, const UString &propertyName) | ### canPut

[const virtual]

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

See also: Object::canPut()

bool hasProperty (ExecState *exec, const UString &propertyName) | ### hasProperty

[const virtual]

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

See also: Object::hasProperty()

bool deleteProperty (ExecState *exec, const UString &propertyName) | ### deleteProperty

[virtual]

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

See also: Object::deleteProperty()

void deleteAllProperties ( ExecState * ) | ### deleteAllProperties

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.

Value defaultValue (ExecState *exec, Type hint) | ### defaultValue

[const virtual]

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

See also: Object::defaultValue()

bool implementsConstruct () | ### implementsConstruct

[const virtual]

Object construct (ExecState *exec, const List &args) | ### construct

[virtual]

Implementation of the [[Construct]] internal property

See also: Object::construct()

bool implementsCall () | ### implementsCall

[const virtual]

Value call (ExecState *exec, Object &thisObj, const List &args) | ### call

[virtual]

Implementation of the [[Call]] internal property

See also: Object::call()

bool implementsHasInstance () | ### implementsHasInstance

[const virtual]

Boolean hasInstance (ExecState *exec, const Value &value) | ### hasInstance

[virtual]

Implementation of the [[HasInstance]] internal property

See also: Object::hasInstance()

const List scope () | ### scope

[const]

Implementation of the [[Scope]] internal property

See also: Object::scope()

void setScope (const List &s) | ### setScope

List propList (ExecState *exec, bool recursive = true) | ### propList

Value internalValue () | ### internalValue

[const]

void setInternalValue (const Value &v) | ### setInternalValue

Value toPrimitive (ExecState *exec, Type preferredType = UnspecifiedType) | ### toPrimitive

[const]

Reimplemented from ValueImp.

bool toBoolean (ExecState *exec) | ### toBoolean

[const]

Reimplemented from ValueImp.

double toNumber (ExecState *exec) | ### toNumber

[const]

Reimplemented from ValueImp.

int toInteger (ExecState *exec) | ### toInteger

[const]

Reimplemented from ValueImp.

int toInt32 (ExecState *exec) | ### toInt32

[const]

Reimplemented from ValueImp.

unsigned int toUInt32 (ExecState *exec) | ### toUInt32

[const]

Reimplemented from ValueImp.

unsigned short toUInt16 (ExecState *exec) | ### toUInt16

[const]

Reimplemented from ValueImp.

UString toString (ExecState *exec) | ### toString

[const]

Reimplemented from ValueImp.

Object toObject (ExecState *exec) | ### toObject

[const]

Reimplemented from ValueImp.

ValueImp* getDirect (const UString& propertyName) | ### getDirect

[const]

Generated by: root on macppc.ports.openbsd.org on Sat Sep 6 10:37:28 2003, using kdoc 2.0a54.