Config.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 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_SRC_FORMAT_CONFIG_H
10#define SQUID_SRC_FORMAT_CONFIG_H
11
12#include "format/Format.h"
13#include "SquidString.h"
14
15#include <list>
16
17class StoreEntry;
18
19namespace Format
20{
21
22class TokenTableEntry;
23
28{
29public:
30 TokenNamespace(const SBuf &nsName, TokenTableEntry const *tSet) : prefix(nsName), tokenSet(tSet) {}
31
34
38};
39
43{
44public:
46 void parseFormats();
47
49 void dumpFormats(StoreEntry *e, const char *name) {
50 formats->dump(e, name);
51 }
52
53 /* Register a namespace set of tokens to be accepted by the format parser.
54 * Multiple arrays can be registered, they will be scanned for
55 * in order registered. So care needs to be taken that arrays registered
56 * first do not overlap or consume tokens registered later for a namespace.
57 */
58 void registerTokens(const SBuf &nsName, TokenTableEntry const *tokenArray);
59
62
64 std::list<TokenNamespace> tokens;
65
66#if USE_ADAPTATION
68#endif
69
70#if ICAP_CLIENT
72#endif
73};
74
75extern FmtConfig TheConfig;
76
77} // namespace Format
78
79// Legacy parsing wrappers
80#define parse_format(X) (X)->parseFormats()
81#define free_format(X) do{ delete (*(X)).formats; (*(X)).formats=NULL; }while(false)
82#define dump_format(E,N,D) (D).dumpFormats((E),(N))
83
84#endif
85
std::list< TokenNamespace > tokens
list of token namespaces registered
Definition: Config.h:64
void parseFormats()
Parse a log format directive line (logfile_format)
Definition: Config.cc:19
Format * formats
Linked list of custom formats.
Definition: Config.h:61
bool hasAdaptToken
Definition: Config.h:67
void registerTokens(const SBuf &nsName, TokenTableEntry const *tokenArray)
Definition: Config.cc:48
void dumpFormats(StoreEntry *e, const char *name)
Dump/display the formats currently known to the provided StoreEntry object.
Definition: Config.h:49
bool hasIcapToken
Definition: Config.h:71
void dump(StoreEntry *entry, const char *directiveName, bool eol=true) const
dump this whole list of formats into the provided StoreEntry
Definition: Format.cc:117
TokenNamespace(const SBuf &nsName, TokenTableEntry const *tSet)
Definition: Config.h:30
TokenTableEntry const * tokenSet
Definition: Config.h:37
SBuf prefix
prefix namespace name (excluding '::')
Definition: Config.h:33
One entry in a table of format tokens.
Definition: SBuf.h:94
FmtConfig TheConfig
Definition: Config.cc:16

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors