]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/esi/Parser.h
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_ESIPARSER_H
10 #define SQUID_ESIPARSER_H
15 virtual void start(const char *el
, const char **attr
, size_t attrCount
) = 0;
16 virtual void end(const char *el
) = 0;
17 virtual void parserDefault (const char *s
, int len
) =0;
18 virtual void parserComment (const char *s
) = 0;
19 virtual ~ESIParserClient() {};
22 #include "base/RefCount.h"
24 class ESIParser
: public RefCountable
28 typedef RefCount
<ESIParser
> Pointer
;
30 static void registerParser(const char *name
, Pointer (*new_func
)(ESIParserClient
*aClient
));
31 static Pointer
NewParser(ESIParserClient
*aClient
);
35 \retval true on success
36 \retval false on what?
38 virtual bool parse(char const *dataToParse
, size_t const lengthOfData
, bool const endOfStream
) = 0;
40 virtual long int lineNumber() const =0;
41 virtual char const * errorString() const =0;
47 static Register
*Parser
;
48 static Register
*Parsers
;
53 class ESIParser::Register
57 Register(const char *_name
, ESIParser::Pointer (*_newParser
)(ESIParserClient
*aClient
));
61 ESIParser::Pointer (*newParser
)(ESIParserClient
*aClient
);
65 #define EsiParserDefinition(ThisClass) \
66 ESIParser::Pointer ThisClass::NewParser(ESIParserClient *aClient) \
68 return new ThisClass (aClient); \
71 #define EsiParserDeclaration \
72 static ESIParser::Pointer NewParser(ESIParserClient *aClient)
74 #endif /* SQUID_ESIPARSER_H */