]>
Commit | Line | Data |
---|---|---|
43ae1d95 | 1 | /* |
b8ae064d | 2 | * Copyright (C) 1996-2023 The Squid Software Foundation and contributors |
43ae1d95 | 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. | |
43ae1d95 | 7 | */ |
8 | ||
ff9d9458 FC |
9 | #ifndef SQUID_SRC_ESI_EXPATPARSER_H |
10 | #define SQUID_SRC_ESI_EXPATPARSER_H | |
43ae1d95 | 11 | |
95cd9022 | 12 | #if USE_SQUID_ESI && HAVE_LIBEXPAT |
8d18bed7 | 13 | |
f99c2cfe | 14 | #include "esi/Parser.h" |
95cd9022 AJ |
15 | |
16 | #if HAVE_EXPAT_H | |
019db3c6 | 17 | #include <expat.h> |
95cd9022 | 18 | #endif |
43ae1d95 | 19 | |
20 | class ESIExpatParser : public ESIParser | |
21 | { | |
22 | ||
23 | public: | |
43ae1d95 | 24 | ESIExpatParser(ESIParserClient *); |
337b9aa4 | 25 | ~ESIExpatParser() override; |
63be0a78 | 26 | |
f53969cc | 27 | /** \retval true on success */ |
337b9aa4 | 28 | bool parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream) override; |
63be0a78 | 29 | |
337b9aa4 AR |
30 | long int lineNumber() const override; |
31 | char const * errorString() const override; | |
43ae1d95 | 32 | |
019db3c6 AR |
33 | EsiParserDeclaration; |
34 | ||
43ae1d95 | 35 | private: |
63be0a78 | 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); | |
43ae1d95 | 42 | XML_Parser &myParser() const {return p;} |
43 | ||
44 | ESIParserClient *theClient; | |
45 | }; | |
46 | ||
8d18bed7 AJ |
47 | #endif /* USE_SQUID_ESI */ |
48 | ||
ff9d9458 | 49 | #endif /* SQUID_SRC_ESI_EXPATPARSER_H */ |
f53969cc | 50 |