diff -r 000000000000 -r 89d6a7a84779 Symbian3/SDK/Source/GUID-D0BD34C9-7793-5FA0-8864-FD7444D62F90.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-D0BD34C9-7793-5FA0-8864-FD7444D62F90.dita Thu Jan 21 18:18:20 2010 +0000 @@ -0,0 +1,86 @@ + + + + + +How to +form linksThis document describes how to use links within a doubly linked +list. +

To form a doubly linked list of CMyClass objects, include +the link object TDblQueLink as a component of CMyClass:

+class CMyClass : public CBase + { + ... + TDblQueLink iDlink; + ... + }; + + + +

Although any kind of object can be an element of a linked list, most lists +consist of elements which are all of the same type.

+

An object can participate in more than one list. For example, to allow CMyClass objects +to participate in two doubly linked lists, include two separate TDblQueLink objects +as components of CMyClass:

+class CMyClass : public CBase + { + ... + TDblQueLink iDlink1; + ... + TDblQueLink iDlink2; + }; + + + +

Elements can also be objects constructed from a variety of classes, all +ultimately derived from the same base class, where that base class includes +the link object as a component. For example, if CBc is a +base class for CD1 which, in turn, is a base class for CD2, +then the elements of the list can consist of a mix of CBc or CDc1 or CDc2 objects.

+class CBc : public CBase + { + ... + TDblQueLink iDlink; + ... + }; +class CDc1 : public CBclass + { + ... + } + +class CDc2 : public CDc1 + { + ... + } + + + + +

New link elements are inserted into an existing list using either TDblQueLink::Enque() or TDblQueLink::AddBefore() function. Note that AddBefore() is not available in v5. +These are prototyped as:

+void Enque(TDblQueLinkBase* aLink); + +void AddBefore(TDblQueLinkBase* aLink); +

Calling Enque() on an element means that this element +is added to the list so that its position follows the element aLink, +as the following figure shows.

+ + + +

Calling AddBefore() on an element means that this element +is added to the list so that its position precedes the element aLink, +as the following figure shows.

+ + + +

Note that new elements cannot be inserted at the beginning or end of a +list using these functions. The AddFirst() and AddLast() members +of the header class TDblQue<class T> must be used +instead.

+
\ No newline at end of file