# namespace KJS | Main namespace. More...
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- struct UChar
- class UString
- class Global
- class KJSO
- class Object
- class Imp
- class List
- enum Type { AbstractType = 1, UndefinedType, NullType, BooleanType, NumberType, StringType, ObjectType, HostType, ReferenceType, CompletionType, FunctionType, InternalFunctionType, DeclaredFunctionType, AnonymousFunctionType, ConstructorType, ActivationType }
- enum Attribute { None = 0, ReadOnly = 1 << 1, DontEnum = 1 << 2, DontDelete = 1 << 3, Internal = 1 << 4 }
- enum Class { UndefClass, ArrayClass, StringClass, BooleanClass, NumberClass, ObjectClass, DateClass, RegExpClass, ErrorClass, FunctionClass }
- enum Compl { Normal, Break, Continue, ReturnValue, Throw }
- enum ErrorType { NoError = 0, GeneralError, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError }
- class Boolean
- class Number
- class String
- struct TypeInfo
- class ObjectImp
- class HostImp
- class Error
- class Undefined
- class Null
- class Completion
- class ListIterator
- class ListNode
- enum CodeType { GlobalCode, EvalCode, FunctionCode, AnonymousCode, HostCode }
- enum FunctionAttribute { ImplicitNone, ImplicitThis, ImplicitParents }
- class Function
- class FunctionImp
- class InternalFunctionImp
- class ConstructorImp
- class Constructor
- class UCharReference
- class CString

#### Public Methods

- bool isNaN (double d)
- bool isInf (double d)
- bool equal (const KJSO& v1, const KJSO& v2)
- int relation (const KJSO& v1, const KJSO& v2)
- double max (double d1, double d2)
- double min (double d1, double d2)
- KJSO add (const KJSO &v1, const KJSO &v2, char oper)
- KJSO mult (const KJSO &v1, const KJSO &v2, char oper)
- 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)

#### Public Members

- Forward Lexer
- Forward Context
- Forward KJScriptImp
- Forward Debugger
- extern const double NaN
- extern const double Inf
- Forward Property
- Forward PropList
- Forward BooleanImp
- Forward NumberImp
- Forward StringImp
- Forward Parameter

## Detailed Description

UChar (struct) | ### UChar

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

Global (class) | ### Global

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) | ### KJSO

Object (class) | ### Object

Imp (class) | ### Imp

List (class) | ### List

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 } | ### Type

Types of classes derived from KJSO

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

Property attributes.

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

Types of classes derived from Object.

enum Compl { Normal, Break, Continue, ReturnValue, Throw } | ### Compl

Completion types.

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

Error codes.

extern const double NaN | ### NaN

extern const double Inf | ### Inf

Boolean (class) | ### Boolean

Number (class) | ### Number

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) | ### String

TypeInfo (struct) | ### TypeInfo

ObjectImp (class) | ### ObjectImp

HostImp (class) | ### HostImp

Error (class) | ### Error

Undefined (class) | ### Undefined

Null (class) | ### Null

Completion (class) | ### Completion

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

See FunctionImp::execute()

See also: FunctionImp

ListIterator (class) | ### ListIterator

ListNode (class) | ### ListNode

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

enum FunctionAttribute { ImplicitNone, ImplicitThis, ImplicitParents } | ### FunctionAttribute

Function (class) | ### Function

FunctionImp (class) | ### FunctionImp

InternalFunctionImp (class) | ### InternalFunctionImp

ConstructorImp (class) | ### ConstructorImp

Constructor (class) | ### Constructor

bool isNaN (double d) | ### isNaN

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

bool isInf (double d) | ### isInf

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

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

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

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) | ### max

double min (double d1, double d2) | ### min

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

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) | ### mult

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

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) | ### CString

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

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

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

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

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

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

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

Generated by: root@i386.ports.openbsd.org on Wed Apr 25 13:58:56 2001, using kdoc 2.0a53.