Parser.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 #ifndef SQUID_ESIPARSER_H
10 #define SQUID_ESIPARSER_H
11 
13 {
14 public:
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() {};
20 };
21 
22 #include "base/RefCount.h"
23 
24 class ESIParser : public RefCountable
25 {
26 public:
27  class Register;
29 
30  static void registerParser(const char *name, Pointer (*new_func)(ESIParserClient *aClient));
31  static Pointer NewParser(ESIParserClient *aClient);
32  static char *Type;
33 
38  virtual bool parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream) = 0;
39 
40  virtual long int lineNumber() const =0;
41  virtual char const * errorString() const =0;
42 
43 protected:
44  ESIParser() {};
45 
46 private:
47  static Register *Parser;
48  static Register *Parsers;
49 
50 public:
51 };
52 
54 {
55 
56 public:
57  Register(const char *_name, ESIParser::Pointer (*_newParser)(ESIParserClient *aClient));
58  ~Register();
59 
60  const char *name;
63 };
64 
65 #define EsiParserDefinition(ThisClass) \
66  ESIParser::Pointer ThisClass::NewParser(ESIParserClient *aClient) \
67  { \
68  return new ThisClass (aClient); \
69  }
70 
71 #define EsiParserDeclaration \
72  static ESIParser::Pointer NewParser(ESIParserClient *aClient)
73 
74 #endif /* SQUID_ESIPARSER_H */
75 
virtual char const * errorString() const =0
virtual void parserComment(const char *s)=0
virtual ~ESIParserClient()
Definition: Parser.h:19
static char * Type
Definition: Parser.h:32
ESIParser()
Definition: Parser.h:44
ESIParser::Pointer(* newParser)(ESIParserClient *aClient)
Definition: Parser.h:61
Register(const char *_name, ESIParser::Pointer(*_newParser)(ESIParserClient *aClient))
Definition: Parser.cc:35
static Register * Parser
Definition: Parser.h:44
static Pointer NewParser(ESIParserClient *aClient)
Definition: Parser.cc:20
Register * next
Definition: Parser.h:62
const char * name
Definition: Parser.h:60
RefCount< ESIParser > Pointer
Definition: Parser.h:27
int unsigned int const char *desc STUB void int len
Definition: stub_fd.cc:20
static void registerParser(const char *name, Pointer(*new_func)(ESIParserClient *aClient))
virtual void start(const char *el, const char **attr, size_t attrCount)=0
static Register * Parsers
Definition: Parser.h:48
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