]> git.ipfire.org Git - thirdparty/squid.git/blame - src/esi/Libxml2Parser.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / esi / Libxml2Parser.h
CommitLineData
964b44c3 1/*
b8ae064d 2 * Copyright (C) 1996-2023 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
50class ESILibxml2Parser : public ESIParser
51{
52
53public:
54 ESILibxml2Parser(ESIParserClient *);
337b9aa4 55 ~ESILibxml2Parser() override;
964b44c3 56 /* true on success */
337b9aa4
AR
57 bool parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream) override;
58 long int lineNumber() const override;
59 char const * errorString() const override;
964b44c3 60
61 ESIParserClient *getClient() { return theClient; }
62
019db3c6
AR
63 EsiParserDeclaration;
64
964b44c3 65private:
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