namespace KJS

Main namespace. More...

List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Members


Detailed Description

UChar (struct)

UChar represents a 16 bit Unicode character. It's internal data representation is compatible to XChar2b and QChar. It's therefore possible to exchange data with X and Qt with shallow copies.

UString (class)

Global (class)

The Global object represents the global namespace. It holds the native objects like String and functions like eval().

It also serves as a container for variables created by the user, i.e. the statement


   var i = 2;

will basically perform a Global::current().put("i", Number(2)); operation.

KJSO (class)

Object (class)

Imp (class)

List (class)

List is a native ECMAScript type. List values are only used for intermediate results of expression evaluation and cannot be stored as properties of objects.

The list is explicitly shared. Note that while copy() returns a deep copy of the list the referenced objects are still shared.

enum Type {AbstractType = 1, UndefinedType, NullType, BooleanType, NumberType, StringType, ObjectType, HostType, ReferenceType, CompletionType, FunctionType, InternalFunctionType, DeclaredFunctionType, AnonymousFunctionType, ConstructorType, ActivationType }

Types of classes derived from KJSO

enum Attribute {None = 0, ReadOnly = 1 << 1, DontEnum = 1 << 2, DontDelete = 1 << 3, Internal = 1 << 4 }

Property attributes.

enum Class {UndefClass, ArrayClass, StringClass, BooleanClass, NumberClass, ObjectClass, DateClass, RegExpClass, ErrorClass, FunctionClass }

Types of classes derived from Object.

enum Compl { Normal, Break, Continue, ReturnValue, Throw }; }

Completion types.

enum ErrorType {NoError = 0, GeneralError, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError }

Error codes.

extern const double NaN

extern const double Inf

Boolean (class)

Number (class)

Number is a handle for a number value. KJSO::toPrimitive(), KJSO::toBoolean(), KJSO::toNumber(), KJSO::toString() and KJSO::toString() are re-implemented internally according to the specification.

Example usage:


 Number a(2), b(3.0), c; // c defaults to 0.0

 c = a.value() * b.value(); // c will be 6.0 now

 String s = c.toString(); // s holds "6"

Note the following implementation detail: Internally, the value is stored as a double and will be casted from and to other types when needed. This won't be noticable within a certain range of values but might produce unpredictable results when crossing these limits. In case this turns out to be a real problem for an application we might have to extend this class to behave more intelligently.

String (class)

TypeInfo (struct)

ObjectImp (class)

HostImp (class)

Error (class)

Undefined (class)

Null (class)

Completion (class)

Completion objects are used to convey the return status and value from functions.

See FunctionImp::execute()

See also: FunctionImp

ListIterator (class)

ListNode (class)

enum CodeType {GlobalCode, EvalCode, FunctionCode, AnonymousCode, HostCode }

enum FunctionAttribute { ImplicitNone, ImplicitThis, ImplicitParents }; }

Function (class)

FunctionImp (class)

InternalFunctionImp (class)

ConstructorImp (class)

Constructor (class)

bool  isNaN (double d)

Returns: True if d is not a number (platform support required).

bool  isInf (double d)

Returns: True if d is infinite (platform support required).

bool  equal (const KJSO& v1, const KJSO& v2)

int  relation (const KJSO& v1, const KJSO& v2)

This operator performs an abstract relational comparision of the two arguments that can be of arbitrary type. If possible, conversions to the string or number type will take place before the comparison.

Returns: 1 if v1 is "less-than" v2, 0 if the relation is "greater-than-or- equal". -1 if the result is undefined.

double  max (double d1, double d2)

double  min (double d1, double d2)

KJSO  add (const KJSO &v1, const KJSO &v2, char oper)

Additive operator. Either performs an addition or substraction of v1 and v2.

Parameters:
oper'+' or '-' for an addition or substraction, respectively.

Returns: The result of the operation.

KJSO  mult (const KJSO &v1, const KJSO &v2, char oper)

Multiplicative operator. Either multiplies/divides v1 and v2 or calculates the remainder from an division.

Parameters:
oper'*', '/' or '%' for a multiplication, division or modulo operation.

Returns: The result of the operation.

UCharReference (class)

UCharReference is the dynamic counterpart of UChar. It's used when characters retrieved via index from a UString are used in an assignment expression (and therefore can't be treated as being const):


 UString s("hello world");
 s[0] = 'H';

If that sounds confusing your best bet is to simply forget about the existance of this class and treat is as being identical to UChar.

CString (class)

bool  operator== (const UChar &c1, const UChar &c2)

bool  operator== (const UString& s1, const UString& s2)

bool  operator< (const UString& s1, const UString& s2)

bool  operator== (const UString& s1, const char *s2)

bool  operator== (const char *s1, const UString& s2)

bool  operator== (const CString& s1, const CString& s2)

UString  operator+ (const UString& s1, const UString& s2)


Generated by: marc@yogi on Tue Mar 27 13:09:05 2001, using kdoc 2.0a48.