Libxml2Parser.h
Go to the documentation of this file.
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 /*
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 
18 #if USE_SQUID_ESI && HAVE_LIBXML2
19 
20 #include "esi/Parser.h"
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
27 
28 #if __clang__
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)
34 #endif /* __clang__ */
35 
36 #if HAVE_LIBXML_PARSER_H
37 #include <libxml/parser.h>
38 #endif
39 #if HAVE_LIBXML_HTMLPARSER_H
40 #include <libxml/HTMLparser.h>
41 #endif
42 #if HAVE_LIBXML_HTMLTREE_H
43 #include <libxml/HTMLtree.h>
44 #endif
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);
58  long int lineNumber() const;
59  char const * errorString() const;
60 
61  ESIParserClient *getClient() { return theClient; }
62 
64 
65 private:
66  mutable xmlParserCtxtPtr parser; /* our parser */
67 
68  ESIParserClient *theClient;
69 };
70 
71 #endif /* USE_SQUID_ESI */
72 
73 #endif /* SQUID_ESILIBXML2PARSER_H */
74 
virtual char const * errorString() const =0
#define EsiParserDeclaration
Definition: Parser.h:71
virtual long int lineNumber() const =0
virtual bool parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream)=0

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors