]> git.ipfire.org Git - thirdparty/squid.git/blame - src/format/Token.h
Boilerplate: update copyright blurbs on Squid helpers
[thirdparty/squid.git] / src / format / Token.h
CommitLineData
31971e6a
AJ
1#ifndef _SQUID_FORMAT_TOKEN_H
2#define _SQUID_FORMAT_TOKEN_H
3
4//#include "format/TokenTableEntry.h"
5#include "format/ByteCode.h"
6
7/*
8 * Squid configuration allows users to define custom formats in
9 * several components.
10 * - logging
11 * - external ACL input
12 * - deny page URL
13 *
14 * These enumerations and classes define the API for parsing of
15 * format directives to define these patterns. Along with output
16 * functionality to produce formatted buffers.
17 */
18
19namespace Format
20{
21
22class TokenTableEntry;
23
24#define LOG_BUF_SZ (MAX_URL<<2)
25
26// XXX: inherit from linked list
27class Token
28{
29public:
c7bcf010 30 Token();
31971e6a
AJ
31 ~Token();
32
33 /// Initialize the format token registrations
34 static void Init();
35
36 /** parses a single token. Returns the token length in characters,
37 * and fills in this item with the token information.
38 * def is for sure null-terminated.
39 */
f4698e0b 40 int parse(const char *def, enum Quoting *quote);
31971e6a
AJ
41
42 ByteCode_t type;
43 const char *label;
c7bcf010 44 struct {
31971e6a
AJ
45 char *string;
46
47 struct {
48 char *header;
49 char *element;
50 char separator;
51 } header;
31971e6a
AJ
52 } data;
53 int widthMin; ///< minimum field width
54 int widthMax; ///< maximum field width
55 enum Quoting quote;
1a6347cd
FC
56 bool left;
57 bool space;
58 bool zero;
4c05e483 59 int divisor; // class invariant: MUST NOT be zero.
31971e6a
AJ
60 Token *next; /* todo: move from linked list to array */
61
62private:
f4698e0b 63 const char *scanForToken(TokenTableEntry const table[], const char *cur);
31971e6a
AJ
64};
65
31971e6a
AJ
66} // namespace Format
67
68#endif /* _SQUID_FORMAT_TOKEN_H */