Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: e32std.h
Link against: euser.lib

Class TDblQue

TDblQue<class T>

Support

Supported from 5.0

Description

A templated class that provides the behaviour for managing a doubly linked list. It also acts as the head of the list, maintaining the pointers into the list.

The template parameter defines the type of element that forms the doubly linked list and is the class that acts as host to the link object.

Derivation

TDblQueA templated class that provides the behaviour for managing a doubly linked list
TDblQueBaseA base class that provides implementation for the doubly linked list header

Defined in TDblQue:
AddFirst(), AddLast(), First(), IsFirst(), IsHead(), IsLast(), Last(), TDblQue()

Inherited from TDblQueBase:
IsEmpty(), Reset(), SetOffset()

See also:


Construction


TDblQue()

TDblQue();

Description

Constructs an empty list header and sets the offset value of the link object to zero.

In practice, never assume that the offset of the link object from the start of a list element is zero, even if the link object is declared as the first data member in the list element class.

If this default constructor is used, then call the SetOffset() function of the base class to ensure that the offset value is set correctly.

See also:


TDblQue()

TDblQue(TInt anOffset);

Description

Constructs an empty list header and sets the offset of the link object to the specified value.

Parameters

TInt anOffset

The offset of the link object from the start of a list element. The macro _FOFF can be used to calculate this value. The value must be divisible by four, otherwise the constructor raises a USER 78 panic..

See also:

[Top]


Managing elements


AddFirst()

void AddFirst(T& aRef);

Description

Inserts the specified list element at the front of the doubly linked list.

If the list is not empty, the specified element becomes the first in the list. What was previously the first element becomes the second in the list.

Parameters

T& aRef

The list element to be inserted at the front of the doubly linked list.


AddLast()

void AddLast(T& aRef);

Description

Inserts the specified list element at the back of the doubly linked list.

If the list is not empty, the specified element becomes the last in the list. What was previously the last element becomes the next to last element in the list.

Parameters

T& aRef

The list element to be inserted at the back of the doubly linked list.

[Top]


Accessing elements


First()

T* First() const;

Description

Returns a pointer to the first list element in the doubly linked list.

Return value

T*

A pointer to the first list element in the doubly linked list. If the list is empty, this pointer is not necessarily NULL and must not be assumed to point to a valid object.


Last()

T* Last() const;

Description

Returns a pointer to the last list element in the doubly linked list.

Return value

T*

A pointer to the last list element in the doubly linked list. If the list is empty, this pointer is not necessarily NULL and must not be assumed to point to a valid object.

[Top]


Information about elements


IsFirst()

TBool IsFirst(const T* aPtr) const;

Description

Tests whether the specified element is the first in the doubly linked list.

Parameters

const T* aPtr

A pointer to the element whose position in the list is to be checked.

Return value

TBool

True, if the element is the first in the list; false, otherwise.


IsLast()

TBool IsLast(const T* aPtr) const;

Description

Tests whether the specified element is the last in the doubly linked list.

Parameters

const T* aPtr

A pointer to the element whose position in the list is to be checked.

Return value

TBool

True, if the element is the last in the list; false, otherwise.


IsHead()

TBool IsHead(const T* aPtr) const;

Description

Tests whether the end of a list has been reached.

A doubly linked list is circular; in following the chain of elements in a list (e.g. using the iterator operator++oroperator--), the chain eventually reaches the end of the list andaPtr corresponds to the header (although it will not point to a valid T object).

Parameters

const T* aPtr

The pointer value to be checked.

Return value

TBool

True, if the end of the list has been reached. False, if the end of the list has not been reached; aPtr points to an element in the list.