Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

KJS::Value Class Reference

#include <value.h>

Inheritance diagram for KJS::Value:

KJS::Boolean KJS::Completion KJS::List KJS::Null KJS::Number KJS::Object KJS::Reference KJS::String KJS::Undefined List of all members.

Public Methods

bool isValid () const
bool isNull () const
Type type () const
bool isA (Type t) const
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
Value getBase (ExecState *exec) const
UString getPropertyName (ExecState *exec) const
Value getValue (ExecState *exec) const
void putValue (ExecState *exec, const Value w)

Detailed Description

Value objects are act as wrappers ("smart pointers") around ValueImp objects and their descendents. Instead of using ValueImps (and derivatives) during normal program execution, you should use a Value-derived class.

Value maintains a pointer to a ValueImp object and uses a reference counting scheme to ensure that the ValueImp object is not deleted or garbage collected.

Note: The conversion operations all return values of various types - if an error occurs during conversion, an error object will instead be returned (where possible), and the execution state's exception will be set appropriately.

Definition at line 156 of file value.h.


Member Function Documentation

Value KJS::Value::getBase (  ExecState *    exec )  const
 

Performs the GetBase type conversion operation on this value (ECMA 8.7)

Since references are supposed to have an Object or null as their base, this method is guaranteed to return either Null() or an Object value.

UString KJS::Value::getPropertyName (  ExecState *    exec )  const
 

Performs the GetPropertyName type conversion operation on this value (ECMA 8.7)

Value KJS::Value::getValue (  ExecState *    exec )  const
 

Performs the GetValue type conversion operation on this value (ECMA 8.7.1)

bool KJS::Value::isA (  Type    t )  const
 

Checks whether or not the value is of a particular tpye

Parameters:
The  type to compare with
Returns:
true if the value is of the specified type, otherwise false

bool KJS::Value::isNull (    ) 
 

Deprecated:
Use !isValid() instead.

bool KJS::Value::isValid (    ) 
 

Returns whether or not this is a valid value. An invalid value has a 0 implementation pointer and should not be used for any other operation than this check. Current use: as a distinct return value signalling failing dynamicCast() calls.

void KJS::Value::putValue (  ExecState *    exec,
const Value    w
) 
 

Performs the PutValue type conversion operation on this value (ECMA 8.7.1)

bool KJS::Value::toBoolean (  ExecState *    exec )  const
 

Performs the ToBoolean type conversion operation on this value (ECMA 9.2)

int KJS::Value::toInt32 (  ExecState *    exec )  const
 

Performs the ToInt32 type conversion operation on this value (ECMA 9.5)

int KJS::Value::toInteger (  ExecState *    exec )  const
 

Performs the ToInteger type conversion operation on this value (ECMA 9.4)

double KJS::Value::toNumber (  ExecState *    exec )  const
 

Performs the ToNumber type conversion operation on this value (ECMA 9.3)

Object KJS::Value::toObject (  ExecState *    exec )  const
 

Performs the ToObject type conversion operation on this value (ECMA 9.9)

Value KJS::Value::toPrimitive (  ExecState *    exec,
Type    preferredType = UnspecifiedType
)  const
 

Performs the ToPrimitive type conversion operation on this value (ECMA 9.1)

UString KJS::Value::toString (  ExecState *    exec )  const
 

Performs the ToString type conversion operation on this value (ECMA 9.8)

unsigned short KJS::Value::toUInt16 (  ExecState *    exec )  const
 

Performs the ToUint16 type conversion operation on this value (ECMA 9.7)

unsigned int KJS::Value::toUInt32 (  ExecState *    exec )  const
 

Performs the ToUint32 type conversion operation on this value (ECMA 9.6)

Type KJS::Value::type (    ) 
 

Returns the type of value. This is one of UndefinedType, NullType, BooleanType, StringType NumberType, ObjectType, ReferenceType, ListType or CompletionType.

Returns:
The type of value


The documentation for this class was generated from the following file:
Generated on Wed Aug 13 23:30:35 2003 for kdelibs by doxygen1.2.18