class List

# class List | Native list type. More...
Full name | `KJS::List`
Definition | `#include <types.h>`
Inherits | KJS::Value [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- List ()
- List (ListImp *v)
- List (const List &v)
- virtual ~List ()
- List& operator= (const List &v)
- void append (const Value& val)
- void prepend (const Value& val)
- void appendList (const List& lst)
- void prependList (const List& lst)
- void removeFirst ()
- void removeLast ()
- void remove (const Value &val)
- void clear ()
- List copy () const
- ListIterator begin () const
- ListIterator end () const
- bool isEmpty () const
- int size () const
- Value at (int i) const
- Value operator[] (int i) const

#### Public Static Methods

- static List dynamicCast (const Value &v)
- static const List empty ()
- static void globalClear ()

## Detailed Description

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.

List () | ### List

List (ListImp *v) | ### List

List (const List &v) | ### List

~List () | ### ~List

[virtual]

List& operator= (const List &v) | ### operator=

Reimplemented from Value.

List dynamicCast (const Value &v) | ### dynamicCast

[static]

Converts a Value into an List. If the value's type is not ListType, a null object will be returned (i.e. one with it's internal pointer set to 0). If you do not know for sure whether the value is of type List, you should check the isNull() methods afterwards before calling any methods on the returned value.

Returns: The value converted to an List

void append (const Value& val) | ### append

Append an object to the end of the list.

Parameters:

val | Pointer to object.

void prepend (const Value& val) | ### prepend

Insert an object at the beginning of the list.

Parameters:

val | Pointer to object.

void appendList (const List& lst) | ### appendList

Appends the items of another list at the end of this one.

void prependList (const List& lst) | ### prependList

Prepend the items of another list to this one. The first item of `lst` will become the first item of the list.

void removeFirst () | ### removeFirst

Remove the element at the beginning of the list.

void removeLast () | ### removeLast

Remove the element at the end of the list.

void remove (const Value &val) | ### remove

void clear () | ### clear

Remove all elements from the list.

List copy () | ### copy

[const]

Returns a deep copy of the list. Ownership is passed to the user who is responsible for deleting the list then.

ListIterator begin () | ### begin

[const]

Returns: A KJS::ListIterator pointing to the first element.

ListIterator end () | ### end

[const]

Returns: A KJS::ListIterator pointing to the last element.

bool isEmpty () | ### isEmpty

[const]

Returns: true if the list is empty. false otherwise.

int size () | ### size

[const]

Returns: the current size of the list.

Value at (int i) | ### at

[const]

Retrieve an element at an indexed position. If you want to iterate trough the whole list using KJS::ListIterator will be faster.

Parameters:

i | List index.

Returns: Return the element at position i. KJS::Undefined if the index is out of range.

Value operator[] (int i) | ### operator[]

[const]

Equivalent to at.

const List empty () | ### empty

[static]

Returns a pointer to a static instance of an empty list. Useful if a function has a List parameter.

void globalClear () | ### globalClear

[static]

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