Parser.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 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 {
18 public:
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 
26 class ESIParser : public RefCountable
27 {
28 public:
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 
45 protected:
46  ESIParser() {};
47 
48 private:
49  static Register *Parser;
50  static std::list<Register *> & GetRegistry();
51 };
52 
54 {
55 
56 public:
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 
virtual char const * errorString() const =0
virtual void parserComment(const char *s)=0
virtual ~ESIParserClient()
Definition: Parser.h:23
static char * Type
Definition: Parser.h:34
ESIParser()
Definition: Parser.h:46
ESIParser::Pointer(* newParser)(ESIParserClient *aClient)
Definition: Parser.h:61
Register(const char *_name, ESIParser::Pointer(*_newParser)(ESIParserClient *aClient))
Definition: Parser.cc:46
static Register * Parser
Definition: Parser.h:46
static Pointer NewParser(ESIParserClient *aClient)
Definition: Parser.cc:26
const char * name
Definition: Parser.h:60
RefCount< ESIParser > Pointer
Definition: Parser.h:29
int unsigned int const char *desc STUB void int len
Definition: stub_fd.cc:20
static std::list< Register * > & GetRegistry()
Definition: Parser.cc:19
static void registerParser(const char *name, Pointer(*new_func)(ESIParserClient *aClient))
virtual void start(const char *el, const char **attr, size_t attrCount)=0
virtual void end(const char *el)=0
virtual long int lineNumber() const =0
virtual void parserDefault(const char *s, int len)=0
virtual bool parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream)=0

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors