Element.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_ESIELEMENT_H
10 #define SQUID_ESIELEMENT_H
11 
12 #include "base/RefCount.h"
13 #include "Debug.h"
14 #include "esi/Segment.h"
15 
16 typedef enum {
22 
23 class ESIElement;
24 
25 struct esiTreeParent : public RefCountable {
26  virtual void provideData (ESISegment::Pointer data, ESIElement * source) {
27  /* make abstract when all functionality complete */
28  assert (0);
29  }
30 
31  virtual void fail(ESIElement * source, char const *reason = NULL) {}
32 
33  virtual ~esiTreeParent() {}
34 };
35 
37 
38 class ESIVarState;
39 
40 class ESIElement : public esiTreeParent
41 {
42 
43 public:
45 
46  /* the types we have */
60  };
61  static ESIElementType_t IdentifyElement (const char *);
63  /* Don't accept children */
64  debugs(86,5, "ESIElement::addElement: Failed for " << this);
65  return false;
66  }
67 
68  virtual void render (ESISegment::Pointer) = 0;
69  /* process this element */
70  virtual esiProcessResult_t process (int dovars) {
71  debugs(86,5, "esiProcessComplete: Processed " << this);
72  return ESI_PROCESS_COMPLETE;
73  }
74 
75  virtual bool mayFail() const {
76  return true;
77  }
78 
79  virtual Pointer makeCacheable() const = 0;
80  virtual Pointer makeUsable(esiTreeParentPtr, ESIVarState &) const = 0;
81 
82  /* The top level no longer needs this element */
83  virtual void finish() = 0;
84 };
85 
86 #endif /* SQUID_ESIELEMENT_H */
87 
virtual esiProcessResult_t process(int dovars)
Definition: Element.h:70
virtual Pointer makeUsable(esiTreeParentPtr, ESIVarState &) const =0
#define assert(EX)
Definition: assert.h:17
virtual void render(ESISegment::Pointer)=0
virtual Pointer makeCacheable() const =0
esiProcessResult_t
Definition: Element.h:16
virtual void fail(ESIElement *source, char const *reason=NULL)
Definition: Element.h:31
RefCount< esiTreeParent > esiTreeParentPtr
Definition: Element.h:36
void const char HLPCB void * data
Definition: stub_helper.cc:16
virtual bool addElement(ESIElement::Pointer)
Definition: Element.h:62
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:123
virtual void finish()=0
virtual bool mayFail() const
Definition: Element.h:75
virtual ~esiTreeParent()
Definition: Element.h:33
virtual void provideData(ESISegment::Pointer data, ESIElement *source)
Definition: Element.h:26
RefCount< ESIElement > Pointer
Definition: Element.h:44
#define NULL
Definition: types.h:166
static ESIElementType_t IdentifyElement(const char *)
Definition: Esi.cc:860
ESIElementType_t
Definition: Element.h:47

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors