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

KJS::List Class Reference

Native list type. More...

#include <types.h>

Inheritance diagram for KJS::List:

KJS::Value List of all members.

Public Methods

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 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

Static Public Methods

List dynamicCast (const Value &v)
const List empty ()

Detailed Description

Native list type.

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.

Definition at line 132 of file types.h.


Member Function Documentation

void KJS::List::append const Value   val
 

Append an object to the end of the list.

Parameters:
val  Pointer to object.

void KJS::List::appendList const List &    lst
 

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

Value KJS::List::at int    i 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.

ListIterator KJS::List::begin  
 

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

void KJS::List::clear  
 

Remove all elements from the list.

List KJS::List::copy  
 

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

List KJS::List::dynamicCast const Value   v [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

const List KJS::List::empty   [static]
 

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

ListIterator KJS::List::end  
 

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

bool KJS::List::isEmpty  
 

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

Value KJS::List::operator[] int    i const
 

Equivalent to at.

void KJS::List::prepend const Value   val
 

Insert an object at the beginning of the list.

Parameters:
val  Pointer to object.

void KJS::List::prependList const List &    lst
 

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

void KJS::List::removeFirst  
 

Remove the element at the beginning of the list.

void KJS::List::removeLast  
 

Remove the element at the end of the list.

int KJS::List::size  
 

Returns:
the current size of the list.


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