]> git.ipfire.org Git - thirdparty/squid.git/blob - src/esi/ExpatParser.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / esi / ExpatParser.h
1 /*
2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #ifndef SQUID_ESIEXPATPARSER_H
10 #define SQUID_ESIEXPATPARSER_H
11
12 #if USE_SQUID_ESI && HAVE_LIBEXPAT
13
14 #include "esi/Parser.h"
15
16 #if HAVE_EXPAT_H
17 #include <expat.h>
18 #endif
19
20 class ESIExpatParser : public ESIParser
21 {
22
23 public:
24 ESIExpatParser(ESIParserClient *);
25 ~ESIExpatParser();
26
27 /** \retval true on success */
28 bool parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream);
29
30 long int lineNumber() const;
31 char const * errorString() const;
32
33 EsiParserDeclaration;
34
35 private:
36 /** our parser */
37 mutable XML_Parser p;
38 static void Start(void *data, const XML_Char *el, const char **attr);
39 static void End(void *data, const XML_Char *el);
40 static void Default (void *data, const XML_Char *s, int len);
41 static void Comment (void *data, const XML_Char *s);
42 XML_Parser &myParser() const {return p;}
43
44 ESIParserClient *theClient;
45 };
46
47 #endif /* USE_SQUID_ESI */
48
49 #endif /* SQUID_ESIEXPATPARSER_H */
50