1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * Header file for generic list handling services |
|
17 * for doubly linked lists. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef _DLIST_H_ |
|
23 #define _DLIST_H_ |
|
24 |
|
25 /* |
|
26 * Includes |
|
27 */ |
|
28 |
|
29 #include "list.h" |
|
30 |
|
31 |
|
32 /* |
|
33 * Defines |
|
34 */ |
|
35 |
|
36 #define DLST_ITEM_SKELETON \ |
|
37 LST_ITEM_SKELETON \ |
|
38 void *prev; |
|
39 |
|
40 |
|
41 /* |
|
42 * Typedefs |
|
43 */ |
|
44 |
|
45 /* A skeleton of a list item type. |
|
46 Each real list item type must include these definitions in the beginning |
|
47 of the structure. This structure has no use as such outside this module. */ |
|
48 typedef struct dlstListItem_s { |
|
49 DLST_ITEM_SKELETON |
|
50 } dlstListItem_t; |
|
51 |
|
52 /* Doubly-linked list */ |
|
53 typedef struct { |
|
54 dlstListItem_t *head; |
|
55 dlstListItem_t *curr; |
|
56 dlstListItem_t *tail; |
|
57 int numItems; |
|
58 } dlst_t; |
|
59 |
|
60 |
|
61 /* |
|
62 * Function prototypes |
|
63 */ |
|
64 |
|
65 /* Double-linked list functions */ |
|
66 int dlstOpen(dlst_t *list); |
|
67 int dlstClose(dlst_t *list); |
|
68 int dlstHead(dlst_t *list, void **item); |
|
69 int dlstTail(dlst_t *list, void **item); |
|
70 int dlstNext(dlst_t *list, void **item); |
|
71 int dlstPrev(dlst_t *list, void **item); |
|
72 int dlstCurr(dlst_t *list, void **item); |
|
73 int dlstNextExists(dlst_t *list); |
|
74 int dlstAddAfterCurr(dlst_t *list, void *item); |
|
75 int dlstAddBeforeCurr(dlst_t *list, void *item); |
|
76 int dlstRemove(dlst_t *list, void **item); |
|
77 #define dlstNumItems(list) ((list)->numItems) |
|
78 |
|
79 #endif |
|
80 // End of File |
|