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
17 extern "C" {
18 #endif
19 
20 typedef struct _xmlLink xmlLink;
21 typedef xmlLink *xmlLinkPtr;
22 
23 typedef struct _xmlList xmlList;
24 typedef xmlList *xmlListPtr;
25 
26 /**
27  * xmlListDeallocator:
28  * @lk:  the data to deallocate
29  *
30  * Callback function used to free data from a list.
31  */
32 typedef 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  */
42 typedef 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  */
52 typedef int (*xmlListWalker) (const void *data, const void *user);
53 
54 /* Creation/Deletion */
55 XMLPUBFUN xmlListPtr XMLCALL
56 		xmlListCreate		(xmlListDeallocator deallocator,
57 	                                 xmlListDataCompare compare);
58 XMLPUBFUN void XMLCALL
59 		xmlListDelete		(xmlListPtr l);
60 
61 /* Basic Operators */
62 XMLPUBFUN void * XMLCALL
63 		xmlListSearch		(xmlListPtr l,
64 					 void *data);
65 XMLPUBFUN void * XMLCALL
66 		xmlListReverseSearch	(xmlListPtr l,
67 					 void *data);
68 XMLPUBFUN int XMLCALL
69 		xmlListInsert		(xmlListPtr l,
70 					 void *data) ;
71 XMLPUBFUN int XMLCALL
72 		xmlListAppend		(xmlListPtr l,
73 					 void *data) ;
74 XMLPUBFUN int XMLCALL
75 		xmlListRemoveFirst	(xmlListPtr l,
76 					 void *data);
77 XMLPUBFUN int XMLCALL
78 		xmlListRemoveLast	(xmlListPtr l,
79 					 void *data);
80 XMLPUBFUN int XMLCALL
81 		xmlListRemoveAll	(xmlListPtr l,
82 					 void *data);
83 XMLPUBFUN void XMLCALL
84 		xmlListClear		(xmlListPtr l);
85 XMLPUBFUN int XMLCALL
86 		xmlListEmpty		(xmlListPtr l);
87 XMLPUBFUN xmlLinkPtr XMLCALL
88 		xmlListFront		(xmlListPtr l);
89 XMLPUBFUN xmlLinkPtr XMLCALL
90 		xmlListEnd		(xmlListPtr l);
91 XMLPUBFUN int XMLCALL
92 		xmlListSize		(xmlListPtr l);
93 
94 XMLPUBFUN void XMLCALL
95 		xmlListPopFront		(xmlListPtr l);
96 XMLPUBFUN void XMLCALL
97 		xmlListPopBack		(xmlListPtr l);
98 XMLPUBFUN int XMLCALL
99 		xmlListPushFront	(xmlListPtr l,
100 					 void *data);
101 XMLPUBFUN int XMLCALL
102 		xmlListPushBack		(xmlListPtr l,
103 					 void *data);
104 
105 /* Advanced Operators */
106 XMLPUBFUN void XMLCALL
107 		xmlListReverse		(xmlListPtr l);
108 XMLPUBFUN void XMLCALL
109 		xmlListSort		(xmlListPtr l);
110 XMLPUBFUN void XMLCALL
111 		xmlListWalk		(xmlListPtr l,
112 					 xmlListWalker walker,
113 					 const void *user);
114 XMLPUBFUN void XMLCALL
115 		xmlListReverseWalk	(xmlListPtr l,
116 					 xmlListWalker walker,
117 					 const void *user);
118 XMLPUBFUN void XMLCALL
119 		xmlListMerge		(xmlListPtr l1,
120 					 xmlListPtr l2);
121 XMLPUBFUN xmlListPtr XMLCALL
122 		xmlListDup		(const xmlListPtr old);
123 XMLPUBFUN int XMLCALL
124 		xmlListCopy		(xmlListPtr cur,
125 					 const xmlListPtr old);
126 /* Link operators */
127 XMLPUBFUN 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