]>
Commit | Line | Data |
---|---|---|
964b44c3 | 1 | /* |
bbc27441 | 2 | * Copyright (C) 1996-2014 The Squid Software Foundation and contributors |
964b44c3 | 3 | * |
bbc27441 AJ |
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. | |
964b44c3 | 7 | */ |
8 | ||
9 | /* | |
10 | * The ESI Libxml2 parser is Copyright (c) 2004 by Joachim Bauch | |
11 | * http://www.joachim-bauch.de | |
12 | * mail@joachim-bauch.de | |
13 | */ | |
14 | ||
15 | #ifndef SQUID_ESILIBXML2PARSER_H | |
16 | #define SQUID_ESILIBXML2PARSER_H | |
17 | ||
95cd9022 | 18 | #if USE_SQUID_ESI && HAVE_LIBXML2 |
8d18bed7 | 19 | |
f99c2cfe | 20 | #include "esi/Parser.h" |
964b44c3 | 21 | // workaround for definition of "free" that prevents include of |
22 | // parser.h from libxml2 without errors | |
23 | #ifdef free | |
24 | #define OLD_FREE free | |
25 | #undef free | |
26 | #endif | |
95cd9022 | 27 | #if HAVE_LIBXML_PARSER_H |
964b44c3 | 28 | #include <libxml/parser.h> |
95cd9022 AJ |
29 | #endif |
30 | #if HAVE_LIBXML_HTMLPARSER_H | |
964b44c3 | 31 | #include <libxml/HTMLparser.h> |
95cd9022 AJ |
32 | #endif |
33 | #if HAVE_LIBXML_HTMLTREE_H | |
964b44c3 | 34 | #include <libxml/HTMLtree.h> |
95cd9022 | 35 | #endif |
964b44c3 | 36 | |
37 | #ifdef OLD_FREE | |
38 | #define free OLD_FREE | |
39 | #endif | |
40 | ||
41 | class ESILibxml2Parser : public ESIParser | |
42 | { | |
43 | ||
44 | public: | |
45 | ESILibxml2Parser(ESIParserClient *); | |
46 | ~ESILibxml2Parser(); | |
47 | /* true on success */ | |
48 | bool parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream); | |
137a13ea | 49 | long int lineNumber() const; |
964b44c3 | 50 | char const * errorString() const; |
51 | ||
52 | ESIParserClient *getClient() { return theClient; } | |
53 | ||
019db3c6 AR |
54 | EsiParserDeclaration; |
55 | ||
964b44c3 | 56 | private: |
57 | mutable xmlParserCtxtPtr parser; /* our parser */ | |
58 | ||
59 | ESIParserClient *theClient; | |
60 | }; | |
61 | ||
8d18bed7 AJ |
62 | #endif /* USE_SQUID_ESI */ |
63 | ||
964b44c3 | 64 | #endif /* SQUID_ESILIBXML2PARSER_H */ |