VirtualBox

source: vbox/trunk/src/libs/libxml2-2.6.30/include/libxml/xmlregexp.h@ 6365

Last change on this file since 6365 was 6076, checked in by vboxsync, 17 years ago

Merged dmik/s2 branch (r25959:26751) to the trunk.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 5.2 KB
Line 
1/*
2 * Summary: regular expressions handling
3 * Description: basic API for libxml regular expressions handling used
4 * for XML Schemas and validation.
5 *
6 * Copy: See Copyright for the status of this software.
7 *
8 * Author: Daniel Veillard
9 */
10
11#ifndef __XML_REGEXP_H__
12#define __XML_REGEXP_H__
13
14#include <libxml/xmlversion.h>
15
16#ifdef LIBXML_REGEXP_ENABLED
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22/**
23 * xmlRegexpPtr:
24 *
25 * A libxml regular expression, they can actually be far more complex
26 * thank the POSIX regex expressions.
27 */
28typedef struct _xmlRegexp xmlRegexp;
29typedef xmlRegexp *xmlRegexpPtr;
30
31/**
32 * xmlRegExecCtxtPtr:
33 *
34 * A libxml progressive regular expression evaluation context
35 */
36typedef struct _xmlRegExecCtxt xmlRegExecCtxt;
37typedef xmlRegExecCtxt *xmlRegExecCtxtPtr;
38
39#ifdef __cplusplus
40}
41#endif
42#include <libxml/tree.h>
43#include <libxml/dict.h>
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48/*
49 * The POSIX like API
50 */
51XMLPUBFUN xmlRegexpPtr XMLCALL
52 xmlRegexpCompile (const xmlChar *regexp);
53XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp);
54XMLPUBFUN int XMLCALL
55 xmlRegexpExec (xmlRegexpPtr comp,
56 const xmlChar *value);
57XMLPUBFUN void XMLCALL
58 xmlRegexpPrint (FILE *output,
59 xmlRegexpPtr regexp);
60XMLPUBFUN int XMLCALL
61 xmlRegexpIsDeterminist(xmlRegexpPtr comp);
62
63/*
64 * Callback function when doing a transition in the automata
65 */
66typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec,
67 const xmlChar *token,
68 void *transdata,
69 void *inputdata);
70
71/*
72 * The progressive API
73 */
74XMLPUBFUN xmlRegExecCtxtPtr XMLCALL
75 xmlRegNewExecCtxt (xmlRegexpPtr comp,
76 xmlRegExecCallbacks callback,
77 void *data);
78XMLPUBFUN void XMLCALL
79 xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec);
80XMLPUBFUN int XMLCALL
81 xmlRegExecPushString(xmlRegExecCtxtPtr exec,
82 const xmlChar *value,
83 void *data);
84XMLPUBFUN int XMLCALL
85 xmlRegExecPushString2(xmlRegExecCtxtPtr exec,
86 const xmlChar *value,
87 const xmlChar *value2,
88 void *data);
89
90XMLPUBFUN int XMLCALL
91 xmlRegExecNextValues(xmlRegExecCtxtPtr exec,
92 int *nbval,
93 int *nbneg,
94 xmlChar **values,
95 int *terminal);
96XMLPUBFUN int XMLCALL
97 xmlRegExecErrInfo (xmlRegExecCtxtPtr exec,
98 const xmlChar **string,
99 int *nbval,
100 int *nbneg,
101 xmlChar **values,
102 int *terminal);
103#ifdef LIBXML_EXPR_ENABLED
104/*
105 * Formal regular expression handling
106 * Its goal is to do some formal work on content models
107 */
108
109/* expressions are used within a context */
110typedef struct _xmlExpCtxt xmlExpCtxt;
111typedef xmlExpCtxt *xmlExpCtxtPtr;
112
113XMLPUBFUN void XMLCALL
114 xmlExpFreeCtxt (xmlExpCtxtPtr ctxt);
115XMLPUBFUN xmlExpCtxtPtr XMLCALL
116 xmlExpNewCtxt (int maxNodes,
117 xmlDictPtr dict);
118
119XMLPUBFUN int XMLCALL
120 xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt);
121XMLPUBFUN int XMLCALL
122 xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt);
123
124/* Expressions are trees but the tree is opaque */
125typedef struct _xmlExpNode xmlExpNode;
126typedef xmlExpNode *xmlExpNodePtr;
127
128typedef enum {
129 XML_EXP_EMPTY = 0,
130 XML_EXP_FORBID = 1,
131 XML_EXP_ATOM = 2,
132 XML_EXP_SEQ = 3,
133 XML_EXP_OR = 4,
134 XML_EXP_COUNT = 5
135} xmlExpNodeType;
136
137/*
138 * 2 core expressions shared by all for the empty language set
139 * and for the set with just the empty token
140 */
141XMLPUBVAR xmlExpNodePtr forbiddenExp;
142XMLPUBVAR xmlExpNodePtr emptyExp;
143
144/*
145 * Expressions are reference counted internally
146 */
147XMLPUBFUN void XMLCALL
148 xmlExpFree (xmlExpCtxtPtr ctxt,
149 xmlExpNodePtr expr);
150XMLPUBFUN void XMLCALL
151 xmlExpRef (xmlExpNodePtr expr);
152
153/*
154 * constructors can be either manual or from a string
155 */
156XMLPUBFUN xmlExpNodePtr XMLCALL
157 xmlExpParse (xmlExpCtxtPtr ctxt,
158 const char *expr);
159XMLPUBFUN xmlExpNodePtr XMLCALL
160 xmlExpNewAtom (xmlExpCtxtPtr ctxt,
161 const xmlChar *name,
162 int len);
163XMLPUBFUN xmlExpNodePtr XMLCALL
164 xmlExpNewOr (xmlExpCtxtPtr ctxt,
165 xmlExpNodePtr left,
166 xmlExpNodePtr right);
167XMLPUBFUN xmlExpNodePtr XMLCALL
168 xmlExpNewSeq (xmlExpCtxtPtr ctxt,
169 xmlExpNodePtr left,
170 xmlExpNodePtr right);
171XMLPUBFUN xmlExpNodePtr XMLCALL
172 xmlExpNewRange (xmlExpCtxtPtr ctxt,
173 xmlExpNodePtr subset,
174 int min,
175 int max);
176/*
177 * The really interesting APIs
178 */
179XMLPUBFUN int XMLCALL
180 xmlExpIsNillable(xmlExpNodePtr expr);
181XMLPUBFUN int XMLCALL
182 xmlExpMaxToken (xmlExpNodePtr expr);
183XMLPUBFUN int XMLCALL
184 xmlExpGetLanguage(xmlExpCtxtPtr ctxt,
185 xmlExpNodePtr expr,
186 const xmlChar**langList,
187 int len);
188XMLPUBFUN int XMLCALL
189 xmlExpGetStart (xmlExpCtxtPtr ctxt,
190 xmlExpNodePtr expr,
191 const xmlChar**tokList,
192 int len);
193XMLPUBFUN xmlExpNodePtr XMLCALL
194 xmlExpStringDerive(xmlExpCtxtPtr ctxt,
195 xmlExpNodePtr expr,
196 const xmlChar *str,
197 int len);
198XMLPUBFUN xmlExpNodePtr XMLCALL
199 xmlExpExpDerive (xmlExpCtxtPtr ctxt,
200 xmlExpNodePtr expr,
201 xmlExpNodePtr sub);
202XMLPUBFUN int XMLCALL
203 xmlExpSubsume (xmlExpCtxtPtr ctxt,
204 xmlExpNodePtr expr,
205 xmlExpNodePtr sub);
206XMLPUBFUN void XMLCALL
207 xmlExpDump (xmlBufferPtr buf,
208 xmlExpNodePtr expr);
209#endif /* LIBXML_EXPR_ENABLED */
210#ifdef __cplusplus
211}
212#endif
213
214#endif /* LIBXML_REGEXP_ENABLED */
215
216#endif /*__XML_REGEXP_H__ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette