Parser.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 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_ESIPARSER_H
10#define SQUID_ESIPARSER_H
11
12#include "base/RefCount.h"
13
14#include <list>
15
17{
18public:
19 virtual void start(const char *el, const char **attr, size_t attrCount) = 0;
20 virtual void end(const char *el) = 0;
21 virtual void parserDefault (const char *s, int len) =0;
22 virtual void parserComment (const char *s) = 0;
23 virtual ~ESIParserClient() {};
24};
25
26class ESIParser : public RefCountable
27{
28public:
29 class Register;
31
32 static void registerParser(const char *name, Pointer (*new_func)(ESIParserClient *aClient));
33 static Pointer NewParser(ESIParserClient *aClient);
34 static char *Type;
35
40 virtual bool parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream) = 0;
41
42 virtual long int lineNumber() const =0;
43 virtual char const * errorString() const =0;
44
45protected:
47
48private:
50 static std::list<Register *> & GetRegistry();
51};
52
54{
55
56public:
57 Register(const char *_name, ESIParser::Pointer (*_newParser)(ESIParserClient *aClient));
58 ~Register();
59
60 const char *name;
62};
63
64#define EsiParserDefinition(ThisClass) \
65 ESIParser::Pointer ThisClass::NewParser(ESIParserClient *aClient) \
66 { \
67 return new ThisClass (aClient); \
68 }
69
70#define EsiParserDeclaration \
71 static ESIParser::Pointer NewParser(ESIParserClient *aClient)
72
73#endif /* SQUID_ESIPARSER_H */
74
#define RefCountable
The locking interface for use on Reference-Counted classes.
Definition: Lock.h:66
virtual ~ESIParserClient()
Definition: Parser.h:23
virtual void start(const char *el, const char **attr, size_t attrCount)=0
virtual void end(const char *el)=0
virtual void parserDefault(const char *s, int len)=0
virtual void parserComment(const char *s)=0
const char * name
Definition: Parser.h:60
ESIParser::Pointer(* newParser)(ESIParserClient *aClient)
Definition: Parser.h:61
Register(const char *_name, ESIParser::Pointer(*_newParser)(ESIParserClient *aClient))
Definition: Parser.cc:55
RefCount< ESIParser > Pointer
Definition: Parser.h:30
virtual bool parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream)=0
static Register * Parser
Definition: Parser.h:49
static char * Type
Definition: Parser.h:34
static std::list< Register * > & GetRegistry()
Definition: Parser.cc:20
virtual long int lineNumber() const =0
static void registerParser(const char *name, Pointer(*new_func)(ESIParserClient *aClient))
ESIParser()
Definition: Parser.h:46
virtual char const * errorString() const =0
static Pointer NewParser(ESIParserClient *aClient)
Definition: Parser.cc:27

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors