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