ConfigOption.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_CONFIGOPTION_H
10 #define SQUID_CONFIGOPTION_H
11 
12 #include <vector>
13 
14 class StoreEntry;
15 
16 /* cache option parsers */
17 
19 {
20 
21 public:
22  virtual ~ConfigOption() {}
23 
24  virtual bool parse(char const *option, const char *value, int reconfiguring) = 0;
25  virtual void dump(StoreEntry * e) const = 0;
26 };
27 
29 {
30 
31 public:
32  virtual ~ConfigOptionVector();
33  virtual bool parse(char const *option, const char *value, int reconfiguring);
34  virtual void dump(StoreEntry * e) const;
35  std::vector<ConfigOption *>options;
36 };
37 
38 template <class C>
40 {
41 
42 public:
43  ConfigOptionAdapter(C& theObject, bool (C::*parseFP)(char const *option, const char *value, int reconfiguring), void (C::*dumpFP)(StoreEntry * e) const) : object(theObject), parser(parseFP), dumper(dumpFP) {}
44 
45  bool parse(char const *option, const char *value, int isaReconf) {
46  if (parser)
47  return (object.*parser)(option, value, isaReconf);
48 
49  return false;
50  }
51 
52  void dump(StoreEntry * e) const {
53  if (dumper)
54  (object.*dumper)(e);
55  }
56 
57 private:
59  bool (C::*parser)(char const *option, const char *value, int reconfiguring) ;
60  void (C::*dumper)(StoreEntry * e) const;
61 };
62 
63 #endif /* SQUID_CONFIGOPTION_H */
64 
virtual bool parse(char const *option, const char *value, int reconfiguring)=0
void dump(StoreEntry *e) const
Definition: ConfigOption.h:52
virtual ~ConfigOption()
Definition: ConfigOption.h:22
virtual void dump(StoreEntry *e) const =0
std::vector< ConfigOption * > options
Definition: ConfigOption.h:35
void(C::* dumper)(StoreEntry *e) const
Definition: ConfigOption.h:60
virtual ~ConfigOptionVector()
Definition: ConfigOption.cc:14
bool parse(char const *option, const char *value, int isaReconf)
Definition: ConfigOption.h:45
bool(C::* parser)(char const *option, const char *value, int reconfiguring)
Definition: ConfigOption.h:59
virtual void dump(StoreEntry *e) const
Definition: ConfigOption.cc:38
ConfigOptionAdapter(C &theObject, bool(C::*parseFP)(char const *option, const char *value, int reconfiguring), void(C::*dumpFP)(StoreEntry *e) const)
Definition: ConfigOption.h:43
virtual bool parse(char const *option, const char *value, int reconfiguring)
Definition: ConfigOption.cc:23
int reconfiguring

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors