Xavax C++ Library | Class Index FAQ Overview |
Constructor Summary |
PSList()
Construct an empty list. |
PSList(const PSList<T>& src)
Construct a new list that is a copy of src. |
Operator Summary | |
PSList<T>&
|
operator=(PSList<T>& src)
Remove all elements, then copy the elements of src to this list. |
Method Summary | |
void
|
append(const T& t)
Append an object of type T to the end of the list. |
void
|
clear()
Remove all elements from the list. |
size_t
|
count() const
Returns the number of elements in the list. |
T*
|
first()
Returns a pointer to the first element in the list. |
void
|
insert(const T& t, size_t p= 0)
Insert object t of type T at position p in the list. |
T*
|
last
Returns a pointer to the last element in the list. |
T*
|
locate(size_t p)
Locate and return a pointer to the element at position p. |
T*
|
locate(bool (proc)(T*,void*), void* data)
Locate and return a pointer to the element selected by proc. |
void
|
managed(bool flag)
Set the state of the managed flag. |
bool
|
managed()
Return the state of the managed flag. |
T
|
remove(size_t p)
Remove and return the element at position p. |
void
|
traverse(TraversalOrder order,
void (proc)(T*,void*), void* data)
Traverse the list in the specified order calling proc for each element. |
Related Classes | |
SList<T>, PSListConstIterator<T>. PSListIterator<T>. |
Constructor Detail |
PSList<T>()
PSList<T>(const PSList<T>& src)
src
- the list to be copied.
Operator Detail |
PSList<T>& operator=(PSList<T>& src)
src
- the list to be copied.
Method Detail |
void append(const T& t)
t
- an object of type T
to be
inserted into the list.void clear()
size_t count() const
T* first()
void insert(const T& t, size_t p= 0)
t
- the object to be inserted in the list.p
- the position at which the object should be inserted.T* last();
T* locate(size_t p)
p
- the position of the object to be retrieved.T* locate(bool (proc)(T*,void*), void* data)
proc
- a function that returns true if an element is selected.data
- can be used to pass client data to proc.void managed(bool flag)
flag
- the new state of the managed flag.bool managed() const
T remove(size_t p)
p
- the position of the object to be removed.
RangeException
- if the list contains fewer than p+1 elements.
void traverse(TraversalOrder order, void (proc)(T*,void*), void* data);
order
- the order of the traversal.proc
- the function to be called for each element.data
- can be used to pass client data to proc.
Example Code |
Copyright © 2003 Xavax Inc. -- All Rights Reserved