# class KJSO | Main base class for every KJS object. More...
Full name | `KJS::KJSO`
Definition | `#include <object.h>`
Inherited by | Boolean, Completion, Constructor, Function, Global, Null, Number, Object, String, Undefined
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- KJSO ()
- KJSO (Imp *d)
- KJSO (const KJSO &)
- KJSO& operator= (const KJSO &)
- virtual ~KJSO ()
- bool isNull () const
- bool isDefined () const
- Type type () const
- bool isA (Type t) const
- bool isA (const char *s) const
- bool isObject () const
- bool derivedFrom (const char *s) const
- KJSO toPrimitive (Type preferred = UndefinedType) const
- Boolean toBoolean () const
- Number toNumber () const
- double round () const
- Number toInteger () const
- int toInt32 () const
- unsigned int toUInt32 () const
- unsigned short toUInt16 () const
- String toString () const
- Object toObject () const
- void setPrototype (const KJSO& p)
- KJSO prototype () const
- KJSO get (const UString &p) const
- bool hasProperty (const UString &p, bool recursive = true) const
- void put (const UString &p, const KJSO& v)
- bool canPut (const UString &p) const
- bool deleteProperty (const UString &p)
- void put (const UString &p, const KJSO& v, int attr)
- void put (const UString &p, double d, int attr = None)
- void put (const UString &p, int i, int attr = None)
- void put (const UString &p, unsigned int u, int attr = None)
- KJSO getBase () const
- UString getPropertyName () const
- KJSO getValue ()
- ErrorType putValue (const KJSO& v)
- bool implementsCall () const
- KJSO executeCall (const KJSO &thisV, const List *args)
- void setConstructor (KJSO c)
- Imp * imp () const

#### Public Members

- static int count

#### Protected Members

- Imp *rep

## Detailed Description

KJSO () | ### KJSO

Constructor.

KJSO (Imp *d) | ### KJSO

KJSO (const KJSO &) | ### KJSO

Copy constructor.

KJSO& operator= (const KJSO &) | ### operator=

~KJSO () | ### ~KJSO

[virtual]

Destructor.

bool isNull () | ### isNull

[const]

Returns: True if this object is null, i.e. if there is no data attached to this object. Don't confuse this with the Null object.

bool isDefined () | ### isDefined

[const]

Returns: True if this objects is of any other value than Undefined.

Type type () | ### type

[const]

Returns: the type of the object. One of the KJS::Type enums.

bool isA (Type t) | ### isA

[const]

Check whether object is of a certain type

Parameters:

t | type to check for

bool isA (const char *s) | ### isA

[const]

Check whether object is of a certain type. Allows checking of host objects, too.

Parameters:

type | name (Number, Boolean etc.)

bool isObject () | ### isObject

[const]

Use this method when checking for objects. It's safer than checking for a single object type with isA().

bool derivedFrom (const char *s) | ### derivedFrom

[const]

Examine the inheritance structure of this object.

Parameters:

t | Name of the base class.

Returns: True if object is of type t or a derived from such a type.

KJSO toPrimitive (Type preferred = UndefinedType) | ### toPrimitive

[const]

Parameters:

preferred | Optional hint. Either StringType or NumberType.

Returns: Conversion to primitive type (Undefined, Boolean, Number or String)

Boolean toBoolean () | ### toBoolean

[const]

Returns: Conversion to Boolean type.

Number toNumber () | ### toNumber

[const]

Returns: Conversion to Number type.

double round () | ### round

[const]

Returns: Conversion to double. 0.0 if conversion failed.

Number toInteger () | ### toInteger

[const]

Returns: Conversion to Number type containing an integer value.

int toInt32 () | ### toInt32

[const]

Returns: Conversion to signed integer value.

unsigned int toUInt32 () | ### toUInt32

[const]

Returns: Conversion to unsigned integer value.

unsigned short toUInt16 () | ### toUInt16

[const]

Returns: Conversion to unsigned short value.

String toString () | ### toString

[const]

Returns: Conversion to String type.

Object toObject () | ### toObject

[const]

Returns: Conversion to Object type.

void setPrototype (const KJSO& p) | ### setPrototype

Set the internal [[prototype]] property of this object.

Parameters:

p | A prototype object.

KJSO prototype () | ### prototype

[const]

Returns: The internal [[prototype]] property.

KJSO get (const UString &p) | ### get

[const]

The internal [[Get]] method.

Returns: The value of property p.

bool hasProperty (const UString &p, bool recursive = true) | ### hasProperty

[const]

The internal [[HasProperty]] method.

Parameters:

p | Property name.
recursive | Indicates whether prototypes are searched as well.

Returns: Boolean value indicating whether the object already has a member with the given name p.

void put (const UString &p, const KJSO& v) | ### put

The internal [[Put]] method. Sets the specified property to the value v.

Parameters:

p | Property name.
v | Value.

bool canPut (const UString &p) | ### canPut

[const]

The internal [[CanPut]] method.

Parameters:

p | Property name.

Returns: A boolean value indicating whether a [[Put]] operation with p succeed.

bool deleteProperty (const UString &p) | ### deleteProperty

The internal [[Delete]] method. Removes the specified property from the object.

Parameters:

p | Property name.

Returns: True if the property was deleted successfully or didn't exist in the first place. False if the DontDelete attribute was set.

void put (const UString &p, const KJSO& v, int attr) | ### put

Same as above put() method except the additional attribute. Right now, this only works with native types as Host Objects don't reimplement this method.

Parameters:

attr | One of KJS::Attribute.

void put (const UString &p, double d, int attr = None) | ### put

Convenience function for adding a Number property constructed from a double value.

void put (const UString &p, int i, int attr = None) | ### put

Convenience function for adding a Number property constructed from an integer value.

void put (const UString &p, unsigned int u, int attr = None) | ### put

Convenience function for adding a Number property constructed from an unsigned integer value.

KJSO getBase () | ### getBase

[const]

Reference method.

Returns: Reference base if object is a reference. Throws a ReferenceError otherwise.

UString getPropertyName () | ### getPropertyName

[const]

Reference method.

Returns: Property name of a reference. Null string if object is not a reference.

KJSO getValue () | ### getValue

Reference method.

Returns: Referenced value. This object if no reference.

ErrorType putValue (const KJSO& v) | ### putValue

Reference method. Set referenced value to v.

bool implementsCall () | ### implementsCall

[const]

Returns: True if object supports executeCall() method. That's the case for all objects derived from FunctionType.

KJSO executeCall (const KJSO &thisV, const List *args) | ### executeCall

Execute function implemented via the Function::execute() method.

Note: check availability via implementsCall() beforehand.

Parameters:

thisV | Object serving as the 'this' value.
args | Pointer to the list of arguments or null.

Returns: Result of the function call.

void setConstructor (KJSO c) | ### setConstructor

Set this object's constructor.

Imp * imp () | ### imp

[const]

Returns: A Pointer to the internal implementation.

static int count | ### count

Imp * rep | ### rep

[protected]

Generated by: root@sparc.ports.openbsd.org on Wed May 2 09:45:14 2001, using kdoc 2.0a53.