]>
Commit | Line | Data |
---|---|---|
964b44c3 | 1 | /* |
ef57eb7b | 2 | * Copyright (C) 1996-2016 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 | |
791d301a | 27 | |
d349d17c | 28 | #if __clang__ |
990104ac FC |
29 | // workaround for clang complaining of unknown attributes in libxml2 on fedora22 |
30 | #ifdef LIBXML_ATTR_ALLOC_SIZE | |
31 | #undef LIBXML_ATTR_ALLOC_SIZE | |
32 | #endif | |
33 | #define LIBXML_ATTR_ALLOC_SIZE(x) | |
791d301a FC |
34 | #endif /* __clang__ */ |
35 | ||
95cd9022 | 36 | #if HAVE_LIBXML_PARSER_H |
964b44c3 | 37 | #include <libxml/parser.h> |
95cd9022 AJ |
38 | #endif |
39 | #if HAVE_LIBXML_HTMLPARSER_H | |
964b44c3 | 40 | #include <libxml/HTMLparser.h> |
95cd9022 AJ |
41 | #endif |
42 | #if HAVE_LIBXML_HTMLTREE_H | |
964b44c3 | 43 | #include <libxml/HTMLtree.h> |
95cd9022 | 44 | #endif |
964b44c3 | 45 | |
46 | #ifdef OLD_FREE | |
47 | #define free OLD_FREE | |
48 | #endif | |
49 | ||
50 | class ESILibxml2Parser : public ESIParser | |
51 | { | |
52 | ||
53 | public: | |
54 | ESILibxml2Parser(ESIParserClient *); | |
55 | ~ESILibxml2Parser(); | |
56 | /* true on success */ | |
57 | bool parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream); | |
137a13ea | 58 | long int lineNumber() const; |
964b44c3 | 59 | char const * errorString() const; |
60 | ||
61 | ESIParserClient *getClient() { return theClient; } | |
62 | ||
019db3c6 AR |
63 | EsiParserDeclaration; |
64 | ||
964b44c3 | 65 | private: |
66 | mutable xmlParserCtxtPtr parser; /* our parser */ | |
67 | ||
68 | ESIParserClient *theClient; | |
69 | }; | |
70 | ||
8d18bed7 AJ |
71 | #endif /* USE_SQUID_ESI */ |
72 | ||
964b44c3 | 73 | #endif /* SQUID_ESILIBXML2PARSER_H */ |
f53969cc | 74 |