]> git.ipfire.org Git - thirdparty/squid.git/blob - src/esi/CustomParser.h
79231f0a8a5d15534974abd86d2ac89356143e58
[thirdparty/squid.git] / src / esi / CustomParser.h
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 #ifndef SQUID_ESICUSTOMPARSER_H
10 #define SQUID_ESICUSTOMPARSER_H
11
12 class Trie;
13
14 /* inherits from */
15 #include "esi/Parser.h"
16
17 #include "sbuf/SBuf.h"
18 #include "SquidString.h"
19
20 /**
21 \ingroup ESIAPI
22 */
23 class ESICustomParser : public ESIParser
24 {
25
26 public:
27 ESICustomParser(ESIParserClient *);
28 ~ESICustomParser();
29 /* true on success */
30 bool parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream);
31 long int lineNumber() const;
32 char const * errorString() const;
33
34 EsiParserDeclaration;
35
36 private:
37 static Trie *SearchTrie;
38 static Trie *GetTrie();
39 enum ESITAG_t {
40 ESITAG=1,
41 ESIENDTAG=2,
42 ESICOMMENT=3
43 };
44
45 char const *findTag(char const *a, size_t b);
46 ESIParserClient *theClient;
47 String error;
48 /* cheap n dirty - buffer it all */
49 SBuf content;
50 /* TODO: make a class of this type code */
51 ESITAG_t lastTag;
52 };
53
54 #endif /* SQUID_ESICUSTOMPARSER_H */
55