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: Daniel Veillard
32  */
33 
34 /*
35  * Summary: API to handle XML Pointers
36  * Description: API to handle XML Pointers
37  * Base implementation was made accordingly to
38  * W3C Candidate Recommendation 7 June 2000
39  * http://www.w3.org/TR/2000/CR-xptr-20000607
40  *
41  * Added support for the element() scheme described in:
42  * W3C Proposed Recommendation 13 November 2002
43  * http://www.w3.org/TR/2002/PR-xptr-element-20021113/
44  */
45 
46 #ifndef __XML_XPTR_H__
47 #define __XML_XPTR_H__
48 
49 #include <libxml/xmlversion.h>
50 
51 #ifdef LIBXML_XPTR_ENABLED
52 
53 #include <libxml/tree.h>
54 #include <libxml/xpath.h>
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 /*
61  * A Location Set
62  */
63 typedef struct _xmlLocationSet xmlLocationSet;
64 typedef xmlLocationSet *xmlLocationSetPtr;
65 struct _xmlLocationSet {
66     int locNr;		      /* number of locations in the set */
67     int locMax;		      /* size of the array as allocated */
68     xmlXPathObjectPtr *locTab;/* array of locations */
69 };
70 
71 /*
72  * Handling of location sets.
73  */
74 
75 XMLPUBFUN xmlLocationSetPtr XMLCALL
76 		    xmlXPtrLocationSetCreate	(xmlXPathObjectPtr val);
77 XMLPUBFUN void XMLCALL
78 		    xmlXPtrFreeLocationSet	(xmlLocationSetPtr obj);
79 XMLPUBFUN xmlLocationSetPtr XMLCALL
80 		    xmlXPtrLocationSetMerge	(xmlLocationSetPtr val1,
81 						 xmlLocationSetPtr val2);
82 XMLPUBFUN xmlXPathObjectPtr XMLCALL
83 		    xmlXPtrNewRange		(xmlNodePtr start,
84 						 int startindex,
85 						 xmlNodePtr end,
86 						 int endindex);
87 XMLPUBFUN xmlXPathObjectPtr XMLCALL
88 		    xmlXPtrNewRangePoints	(xmlXPathObjectPtr start,
89 						 xmlXPathObjectPtr end);
90 XMLPUBFUN xmlXPathObjectPtr XMLCALL
91 		    xmlXPtrNewRangeNodePoint	(xmlNodePtr start,
92 						 xmlXPathObjectPtr end);
93 XMLPUBFUN xmlXPathObjectPtr XMLCALL
94 		    xmlXPtrNewRangePointNode	(xmlXPathObjectPtr start,
95 						 xmlNodePtr end);
96 XMLPUBFUN xmlXPathObjectPtr XMLCALL
97 		    xmlXPtrNewRangeNodes	(xmlNodePtr start,
98 						 xmlNodePtr end);
99 XMLPUBFUN xmlXPathObjectPtr XMLCALL
100 		    xmlXPtrNewLocationSetNodes	(xmlNodePtr start,
101 						 xmlNodePtr end);
102 XMLPUBFUN xmlXPathObjectPtr XMLCALL
103 		    xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set);
104 XMLPUBFUN xmlXPathObjectPtr XMLCALL
105 		    xmlXPtrNewRangeNodeObject	(xmlNodePtr start,
106 						 xmlXPathObjectPtr end);
107 XMLPUBFUN xmlXPathObjectPtr XMLCALL
108 		    xmlXPtrNewCollapsedRange	(xmlNodePtr start);
109 XMLPUBFUN void XMLCALL
110 		    xmlXPtrLocationSetAdd	(xmlLocationSetPtr cur,
111 						 xmlXPathObjectPtr val);
112 XMLPUBFUN xmlXPathObjectPtr XMLCALL
113 		    xmlXPtrWrapLocationSet	(xmlLocationSetPtr val);
114 XMLPUBFUN void XMLCALL
115 		    xmlXPtrLocationSetDel	(xmlLocationSetPtr cur,
116 						 xmlXPathObjectPtr val);
117 XMLPUBFUN void XMLCALL
118 		    xmlXPtrLocationSetRemove	(xmlLocationSetPtr cur,
119 						 int val);
120 
121 /*
122  * Functions.
123  */
124 XMLPUBFUN xmlXPathContextPtr XMLCALL
125 		    xmlXPtrNewContext		(xmlDocPtr doc,
126 						 xmlNodePtr here,
127 						 xmlNodePtr origin);
128 XMLPUBFUN xmlXPathObjectPtr XMLCALL
129 		    xmlXPtrEval			(const xmlChar *str,
130 						 xmlXPathContextPtr ctx);
131 XMLPUBFUN void XMLCALL
132 		    xmlXPtrRangeToFunction	(xmlXPathParserContextPtr ctxt,
133 						 int nargs);
134 XMLPUBFUN xmlNodePtr XMLCALL
135 		    xmlXPtrBuildNodeList	(xmlXPathObjectPtr obj);
136 XMLPUBFUN void XMLCALL
137 		    xmlXPtrEvalRangePredicate	(xmlXPathParserContextPtr ctxt);
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif /* LIBXML_XPTR_ENABLED */
143 #endif /* __XML_XPTR_H__ */
144