]> git.ipfire.org Git - thirdparty/squid.git/blob - src/format/TokenTableEntry.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / format / TokenTableEntry.h
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_FORMAT_TOKENTABLEENTRY_H
10 #define _SQUID_FORMAT_TOKENTABLEENTRY_H
11
12 #include "format/ByteCode.h"
13
14 /*
15 * Squid configuration allows users to define custom formats in
16 * several components.
17 * - logging
18 * - external ACL input
19 * - deny page URL
20 *
21 * These enumerations and classes define the API for parsing of
22 * format directives to define these patterns. Along with output
23 * functionality to produce formatted buffers.
24 */
25
26 namespace Format
27 {
28
29 /// One entry in a table of format tokens.
30 class TokenTableEntry
31 {
32 public:
33 TokenTableEntry() : configTag(nullptr), tokenType(LFT_NONE), options(0) {}
34 TokenTableEntry(const char *aTag, const ByteCode_t &aType) : configTag(aTag), tokenType(aType), options(0) {}
35 // nothing to destruct configTag is pointer to global const string
36 ~TokenTableEntry() {}
37 TokenTableEntry(const TokenTableEntry& t) : configTag(t.configTag), tokenType(t.tokenType), options(t.options) {}
38
39 /// the config file ASCII representation for this token
40 /// just the base tag bytes, excluding any option syntax bytes
41 const char *configTag;
42
43 /// the internal byte code representatio of this token
44 ByteCode_t tokenType;
45
46 /// 32-bit mask? of options affecting the output display of this token
47 uint32_t options;
48
49 private:
50 TokenTableEntry &operator =(const TokenTableEntry&); // not implemented
51 };
52
53 } // namespace Format
54
55 #endif /* _SQUID_FORMAT_TOKENTABLEENTRY_H */
56