rwlogo

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
List of all members | Public Member Functions
IlListOf(NAME) Class Reference

A generic class that handles lists. More...

#include <ilog/list.h>

Public Member Functions

 IlListOf(NAME) ()
 Constructor. More...
 
 ~IlListOf(NAME) ()
 Destructor. More...
 
void append (TYPE element)
 Appends an element to the list. More...
 
IlListOf(NAME)copy () const
 Creates a copy of this list. More...
 
void empty ()
 Empties the list. More...
 
IlBoolean find (TYPE element) const
 Queries the existence of an element. More...
 
IlUInt getLength () const
 Retrieves the length of the list. More...
 
TYPE getValue (IlUInt pos) const
 Retrieves an element. More...
 
void insert (TYPE element, IlInt pos=0)
 Inserts an element in the list. More...
 
TYPE operator[] (IlUInt pos) const
 Retrieves an element. More...
 
IlBoolean remove (TYPE element)
 Removes an element. More...
 

Detailed Description

A generic class that handles lists.

Library: ilog

This class is generated by the macro IlDefineListOf(NAME, TYPE).
It handles a list of objects of the type TYPE. The major restriction of this class is that TYPE must be a type that can be cast to and from a void*.
An IlListOf(NAME) is a single linked list that can be grown and queried. It does not handle the deletion of the object it stores.
There are different ways of enumerating the elements of an IlListOf(NAME):

See Also
IlListIteratorOf(NAME), IlSafeListIteratorOf(NAME).

Constructor & Destructor Documentation

IlListOf(NAME)::IlListOf(NAME) ( )

Constructor.

Initializes a new empty list.

IlListOf(NAME)::~IlListOf(NAME) ( )

Destructor.

Empties the list.

Note
This destructor does not delete the elements themselves. Before you destroy a list, make sure you have properly deleted the elements it stored, if you don't need them anymore.

Member Function Documentation

void IlListOf(NAME)::append ( TYPE  element)

Appends an element to the list.

The new element becomes the last element of this list. The element is not copied.

Parameters
elementThe element that must be appended to the list.
See Also
insert().
IlListOf(NAME)* IlListOf(NAME)::copy ( ) const

Creates a copy of this list.

The elements are not copied.

Returns
A copy of this list.
void IlListOf(NAME)::empty ( )

Empties the list.

The elements are not destroyed. The list is left with no elements.

IlBoolean IlListOf(NAME)::find ( TYPE  element) const

Queries the existence of an element.

Parameters
elementThe element that is searched in the list.
Returns
IlTrue if the element is stored in the list, and IlFalse if it is not.
IlUInt IlListOf(NAME)::getLength ( ) const

Retrieves the length of the list.

Returns
The number of elements that are stored in this list.
TYPE IlListOf(NAME)::getValue ( IlUInt  pos) const

Retrieves an element.

Parameters
posThe index, in this list, of the element to be retrieved.
Returns
The element, or 0 if the index is invalid. Note that 0 is a also a valid value for an element in the list.
void IlListOf(NAME)::insert ( TYPE  element,
IlInt  pos = 0 
)

Inserts an element in the list.

The element is not copied.

Parameters
elementThe element that must be inserted in the list.
posThe position, in the list where this element must be inserted. 0 indicates that you want element to become the first element of the list. Any invalid value (such as a negative location, or an index that is greater than the size of the list) will append element to the list.
See Also
append().
TYPE IlListOf(NAME)::operator[] ( IlUInt  pos) const

Retrieves an element.

Parameters
posThe index, in this list, of the element to be retrieved.
Returns
The element, or 0 if the index is invalid. Note that 0 is a also a valid value for an element in the list.
IlBoolean IlListOf(NAME)::remove ( TYPE  element)

Removes an element.

The element is not destroyed.

Parameters
elementThe element that is removed from the list.
Returns
IlTrue if the element was removed successfully. If the element is not stored in this list, this member function returns IlFalse, indicating that a problem occurred.

© Copyright 2015, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.