Element.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 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/Stream.h"
14#include "esi/Segment.h"
15
16#include <vector>
17
18typedef enum {
24
25class ESIElement;
26
27struct esiTreeParent : public RefCountable {
28 virtual void provideData (ESISegment::Pointer /* data */, ESIElement * /* source */ ) {
29 /* make abstract when all functionality complete */
30 assert (0);
31 }
32
33 virtual void fail(ESIElement * /* source */, char const * /* reason */ = nullptr) {}
34
35 virtual ~esiTreeParent() {}
36};
37
39
40class ESIVarState;
41
43{
44
45public:
47
48 /* the types we have */
62 };
63 static ESIElementType_t IdentifyElement (const char *);
65 /* Don't accept children */
66 debugs(86,5, "ESIElement::addElement: Failed for " << this);
67 return false;
68 }
69
70 virtual void render (ESISegment::Pointer) = 0;
71 /* process this element */
73 debugs(86,5, "esiProcessComplete: Processed " << this);
75 }
76
77 virtual bool mayFail() const {
78 return true;
79 }
80
81 virtual Pointer makeCacheable() const = 0;
83
84 /* The top level no longer needs this element */
85 virtual void finish() = 0;
86};
87
89namespace Esi {
90
92typedef std::vector<ESIElement::Pointer> Elements;
93
94} // namespace Esi
95
99extern void FinishAnElement(ESIElement::Pointer &, int pos = -1);
100
101// for all elements call finish() and set Pointer to nil
102extern void FinishAllElements(Esi::Elements &);
103
104#endif /* SQUID_ESIELEMENT_H */
105
esiProcessResult_t
Definition: Element.h:18
@ ESI_PROCESS_FAILED
Definition: Element.h:22
@ ESI_PROCESS_PENDING_WONTFAIL
Definition: Element.h:20
@ ESI_PROCESS_COMPLETE
Definition: Element.h:19
@ ESI_PROCESS_PENDING_MAYFAIL
Definition: Element.h:21
RefCount< esiTreeParent > esiTreeParentPtr
Definition: Element.h:38
void FinishAnElement(ESIElement::Pointer &, int pos=-1)
Definition: Esi.cc:1973
void FinishAllElements(Esi::Elements &)
Definition: Esi.cc:1983
#define RefCountable
The locking interface for use on Reference-Counted classes.
Definition: Lock.h:66
#define assert(EX)
Definition: assert.h:19
virtual void render(ESISegment::Pointer)=0
virtual void finish()=0
ESIElementType_t
Definition: Element.h:49
@ ESI_ELEMENT_WHEN
Definition: Element.h:59
@ ESI_ELEMENT_NONE
Definition: Element.h:50
@ ESI_ELEMENT_COMMENT
Definition: Element.h:52
@ ESI_ELEMENT_CHOOSE
Definition: Element.h:58
@ ESI_ELEMENT_VARS
Definition: Element.h:57
@ ESI_ELEMENT_INCLUDE
Definition: Element.h:51
@ ESI_ELEMENT_EXCEPT
Definition: Element.h:56
@ ESI_ELEMENT_TRY
Definition: Element.h:54
@ ESI_ELEMENT_OTHERWISE
Definition: Element.h:60
@ ESI_ELEMENT_REMOVE
Definition: Element.h:53
@ ESI_ELEMENT_ATTEMPT
Definition: Element.h:55
@ ESI_ELEMENT_ASSIGN
Definition: Element.h:61
virtual bool mayFail() const
Definition: Element.h:77
static ESIElementType_t IdentifyElement(const char *)
Definition: Esi.cc:852
virtual Pointer makeCacheable() const =0
virtual Pointer makeUsable(esiTreeParentPtr, ESIVarState &) const =0
RefCount< ESIElement > Pointer
Definition: Element.h:46
virtual esiProcessResult_t process(int)
Definition: Element.h:72
virtual bool addElement(ESIElement::Pointer)
Definition: Element.h:64
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:196
ESI protocol types and operators.
Definition: Element.h:89
std::vector< ESIElement::Pointer > Elements
an ordered set of ESI elements
Definition: Element.h:92
virtual ~esiTreeParent()
Definition: Element.h:35
virtual void fail(ESIElement *, char const *=nullptr)
Definition: Element.h:33
virtual void provideData(ESISegment::Pointer, ESIElement *)
Definition: Element.h:28

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors