equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __LINKLIST_H__ |
|
20 #define __LINKLIST_H__ |
|
21 |
|
22 class LinkedListIterator; |
|
23 class LinkedList; |
|
24 |
|
25 class ListItem |
|
26 { |
|
27 friend class LinkedList; |
|
28 friend class LinkedListIterator; |
|
29 public: |
|
30 ListItem(); |
|
31 virtual ~ListItem(); |
|
32 private: |
|
33 ListItem* iNext; |
|
34 }; |
|
35 |
|
36 class LinkedList |
|
37 { |
|
38 friend class LinkedListIterator; |
|
39 public: |
|
40 LinkedList(); |
|
41 ~LinkedList(); |
|
42 void AddToHead(ListItem* aNewItem); |
|
43 void AddToTail(ListItem* aNewItem); |
|
44 void AddAfter(ListItem* aBeforeItem,ListItem* aNewItem); |
|
45 void RemoveItem(ListItem* aItem); |
|
46 ListItem* TailItem(); |
|
47 ListItem* Previous(ListItem* aItem); |
|
48 void DeleteAll(); |
|
49 int IsEmpty(); |
|
50 private: |
|
51 ListItem* iHead; |
|
52 ListItem* iTail; |
|
53 }; |
|
54 |
|
55 class LinkedListIterator |
|
56 { |
|
57 public: |
|
58 LinkedListIterator(const LinkedList& aList); |
|
59 LinkedListIterator(ListItem* aItem); |
|
60 ListItem* operator()(); |
|
61 void Reset(); |
|
62 private: |
|
63 const LinkedList* iList; |
|
64 ListItem* iCurrentItem; |
|
65 }; |
|
66 |
|
67 #endif |