1 /* libxml2 - Library for parsing XML documents 2 * Copyright (C) 2006-2019 Free Software Foundation, Inc. 3 * 4 * This file is not part of the GNU gettext program, but is used with 5 * GNU gettext. 6 * 7 * The original copyright notice is as follows: 8 */ 9 10 /* 11 * Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved. 12 * 13 * Permission is hereby granted, free of charge, to any person obtaining a copy 14 * of this software and associated documentation files (the "Software"), to deal 15 * in the Software without restriction, including without limitation the rights 16 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 * copies of the Software, and to permit persons to whom the Software is fur- 18 * nished to do so, subject to the following conditions: 19 * 20 * The above copyright notice and this permission notice shall be included in 21 * all copies or substantial portions of the Software. 22 * 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- 25 * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 * THE SOFTWARE. 30 * 31 * Author: Gary Pennington <Gary.Pennington@uk.sun.com> 32 */ 33 34 /* 35 * Summary: lists interfaces 36 * Description: this module implement the list support used in 37 * various place in the library. 38 */ 39 40 #ifndef __XML_LINK_INCLUDE__ 41 #define __XML_LINK_INCLUDE__ 42 43 #include <libxml/xmlversion.h> 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 49 typedef struct _xmlLink xmlLink; 50 typedef xmlLink *xmlLinkPtr; 51 52 typedef struct _xmlList xmlList; 53 typedef xmlList *xmlListPtr; 54 55 /** 56 * xmlListDeallocator: 57 * @lk: the data to deallocate 58 * 59 * Callback function used to free data from a list. 60 */ 61 typedef void (*xmlListDeallocator) (xmlLinkPtr lk); 62 /** 63 * xmlListDataCompare: 64 * @data0: the first data 65 * @data1: the second data 66 * 67 * Callback function used to compare 2 data. 68 * 69 * Returns 0 is equality, -1 or 1 otherwise depending on the ordering. 70 */ 71 typedef int (*xmlListDataCompare) (const void *data0, const void *data1); 72 /** 73 * xmlListWalker: 74 * @data: the data found in the list 75 * @user: extra user provided data to the walker 76 * 77 * Callback function used when walking a list with xmlListWalk(). 78 * 79 * Returns 0 to stop walking the list, 1 otherwise. 80 */ 81 typedef int (*xmlListWalker) (const void *data, void *user); 82 83 /* Creation/Deletion */ 84 XMLPUBFUN xmlListPtr XMLCALL 85 xmlListCreate (xmlListDeallocator deallocator, 86 xmlListDataCompare compare); 87 XMLPUBFUN void XMLCALL 88 xmlListDelete (xmlListPtr l); 89 90 /* Basic Operators */ 91 XMLPUBFUN void * XMLCALL 92 xmlListSearch (xmlListPtr l, 93 void *data); 94 XMLPUBFUN void * XMLCALL 95 xmlListReverseSearch (xmlListPtr l, 96 void *data); 97 XMLPUBFUN int XMLCALL 98 xmlListInsert (xmlListPtr l, 99 void *data) ; 100 XMLPUBFUN int XMLCALL 101 xmlListAppend (xmlListPtr l, 102 void *data) ; 103 XMLPUBFUN int XMLCALL 104 xmlListRemoveFirst (xmlListPtr l, 105 void *data); 106 XMLPUBFUN int XMLCALL 107 xmlListRemoveLast (xmlListPtr l, 108 void *data); 109 XMLPUBFUN int XMLCALL 110 xmlListRemoveAll (xmlListPtr l, 111 void *data); 112 XMLPUBFUN void XMLCALL 113 xmlListClear (xmlListPtr l); 114 XMLPUBFUN int XMLCALL 115 xmlListEmpty (xmlListPtr l); 116 XMLPUBFUN xmlLinkPtr XMLCALL 117 xmlListFront (xmlListPtr l); 118 XMLPUBFUN xmlLinkPtr XMLCALL 119 xmlListEnd (xmlListPtr l); 120 XMLPUBFUN int XMLCALL 121 xmlListSize (xmlListPtr l); 122 123 XMLPUBFUN void XMLCALL 124 xmlListPopFront (xmlListPtr l); 125 XMLPUBFUN void XMLCALL 126 xmlListPopBack (xmlListPtr l); 127 XMLPUBFUN int XMLCALL 128 xmlListPushFront (xmlListPtr l, 129 void *data); 130 XMLPUBFUN int XMLCALL 131 xmlListPushBack (xmlListPtr l, 132 void *data); 133 134 /* Advanced Operators */ 135 XMLPUBFUN void XMLCALL 136 xmlListReverse (xmlListPtr l); 137 XMLPUBFUN void XMLCALL 138 xmlListSort (xmlListPtr l); 139 XMLPUBFUN void XMLCALL 140 xmlListWalk (xmlListPtr l, 141 xmlListWalker walker, 142 void *user); 143 XMLPUBFUN void XMLCALL 144 xmlListReverseWalk (xmlListPtr l, 145 xmlListWalker walker, 146 void *user); 147 XMLPUBFUN void XMLCALL 148 xmlListMerge (xmlListPtr l1, 149 xmlListPtr l2); 150 XMLPUBFUN xmlListPtr XMLCALL 151 xmlListDup (const xmlListPtr old); 152 XMLPUBFUN int XMLCALL 153 xmlListCopy (xmlListPtr cur, 154 const xmlListPtr old); 155 /* Link operators */ 156 XMLPUBFUN void * XMLCALL 157 xmlLinkGetData (xmlLinkPtr lk); 158 159 /* xmlListUnique() */ 160 /* xmlListSwap */ 161 162 #ifdef __cplusplus 163 } 164 #endif 165 166 #endif /* __XML_LINK_INCLUDE__ */ 167