1/*
2 * Summary: lists interfaces
3 * Description: this module implement the list support used in
4 * various place in the library.
5 *
6 * Copy: See Copyright for the status of this software.
7 *
8 * Author: Gary Pennington <Gary.Pennington@uk.sun.com>
9 */
10
11#ifndef __XML_LINK_INCLUDE__
12#define __XML_LINK_INCLUDE__
13
14#include <libxml/xmlversion.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20typedef struct _xmlLink xmlLink;
21typedef xmlLink *xmlLinkPtr;
22
23typedef struct _xmlList xmlList;
24typedef xmlList *xmlListPtr;
25
26/**
27 * xmlListDeallocator:
28 * @lk: the data to deallocate
29 *
30 * Callback function used to free data from a list.
31 */
32typedef void (*xmlListDeallocator) (xmlLinkPtr lk);
33/**
34 * xmlListDataCompare:
35 * @data0: the first data
36 * @data1: the second data
37 *
38 * Callback function used to compare 2 data.
39 *
40 * Returns 0 is equality, -1 or 1 otherwise depending on the ordering.
41 */
42typedef int (*xmlListDataCompare) (const void *data0, const void *data1);
43/**
44 * xmlListWalker:
45 * @data: the data found in the list
46 * @user: extra user provided data to the walker
47 *
48 * Callback function used when walking a list with xmlListWalk().
49 *
50 * Returns 0 to stop walking the list, 1 otherwise.
51 */
52typedef int (*xmlListWalker) (const void *data, const void *user);
53
54/* Creation/Deletion */
55XMLPUBFUN xmlListPtr XMLCALL
56 xmlListCreate (xmlListDeallocator deallocator,
57 xmlListDataCompare compare);
58XMLPUBFUN void XMLCALL
59 xmlListDelete (xmlListPtr l);
60
61/* Basic Operators */
62XMLPUBFUN void * XMLCALL
63 xmlListSearch (xmlListPtr l,
64 void *data);
65XMLPUBFUN void * XMLCALL
66 xmlListReverseSearch (xmlListPtr l,
67 void *data);
68XMLPUBFUN int XMLCALL
69 xmlListInsert (xmlListPtr l,
70 void *data) ;
71XMLPUBFUN int XMLCALL
72 xmlListAppend (xmlListPtr l,
73 void *data) ;
74XMLPUBFUN int XMLCALL
75 xmlListRemoveFirst (xmlListPtr l,
76 void *data);
77XMLPUBFUN int XMLCALL
78 xmlListRemoveLast (xmlListPtr l,
79 void *data);
80XMLPUBFUN int XMLCALL
81 xmlListRemoveAll (xmlListPtr l,
82 void *data);
83XMLPUBFUN void XMLCALL
84 xmlListClear (xmlListPtr l);
85XMLPUBFUN int XMLCALL
86 xmlListEmpty (xmlListPtr l);
87XMLPUBFUN xmlLinkPtr XMLCALL
88 xmlListFront (xmlListPtr l);
89XMLPUBFUN xmlLinkPtr XMLCALL
90 xmlListEnd (xmlListPtr l);
91XMLPUBFUN int XMLCALL
92 xmlListSize (xmlListPtr l);
93
94XMLPUBFUN void XMLCALL
95 xmlListPopFront (xmlListPtr l);
96XMLPUBFUN void XMLCALL
97 xmlListPopBack (xmlListPtr l);
98XMLPUBFUN int XMLCALL
99 xmlListPushFront (xmlListPtr l,
100 void *data);
101XMLPUBFUN int XMLCALL
102 xmlListPushBack (xmlListPtr l,
103 void *data);
104
105/* Advanced Operators */
106XMLPUBFUN void XMLCALL
107 xmlListReverse (xmlListPtr l);
108XMLPUBFUN void XMLCALL
109 xmlListSort (xmlListPtr l);
110XMLPUBFUN void XMLCALL
111 xmlListWalk (xmlListPtr l,
112 xmlListWalker walker,
113 const void *user);
114XMLPUBFUN void XMLCALL
115 xmlListReverseWalk (xmlListPtr l,
116 xmlListWalker walker,
117 const void *user);
118XMLPUBFUN void XMLCALL
119 xmlListMerge (xmlListPtr l1,
120 xmlListPtr l2);
121XMLPUBFUN xmlListPtr XMLCALL
122 xmlListDup (const xmlListPtr old);
123XMLPUBFUN int XMLCALL
124 xmlListCopy (xmlListPtr cur,
125 const xmlListPtr old);
126/* Link operators */
127XMLPUBFUN void * XMLCALL
128 xmlLinkGetData (xmlLinkPtr lk);
129
130/* xmlListUnique() */
131/* xmlListSwap */
132
133#ifdef __cplusplus
134}
135#endif
136
137#endif /* __XML_LINK_INCLUDE__ */
138