Token.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_FORMAT_TOKEN_H
10 #define _SQUID_FORMAT_TOKEN_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 class TokenTableEntry;
30 
31 #define LOG_BUF_SZ (MAX_URL<<2)
32 
33 // XXX: inherit from linked list
34 class Token
35 {
36 public:
37  Token();
38  ~Token();
39 
41  static void Init();
42 
47  int parse(const char *def, enum Quoting *quote);
48 
50  const char *label;
51  struct {
52  char *string;
53 
54  struct {
55  char *header;
56  char *element;
57  char separator;
58  } header;
59  } data;
60  int widthMin;
61  int widthMax;
62  enum Quoting quote;
63  bool left;
64  bool space;
65  bool zero;
66  int divisor; // class invariant: MUST NOT be zero.
67  Token *next; /* todo: move from linked list to array */
68 
69 private:
70  const char *scanForToken(TokenTableEntry const table[], const char *cur);
71 };
72 
73 } // namespace Format
74 
75 #endif /* _SQUID_FORMAT_TOKEN_H */
76 
char * header
Definition: Token.h:55
enum Quoting quote
Definition: Token.h:62
const char * scanForToken(TokenTableEntry const table[], const char *cur)
Definition: Token.cc:257
Token * next
Definition: Token.h:67
char * string
Definition: Token.h:52
int parse(const char *def, enum Quoting *quote)
Definition: Token.cc:276
One entry in a table of format tokens.
Quoting
Quoting style for a format output.
Definition: ByteCode.h:249
int divisor
Definition: Token.h:66
bool left
Definition: Token.h:63
ByteCode_t type
Definition: Token.h:49
bool space
Definition: Token.h:64
int cur
Definition: ModDevPoll.cc:76
char separator
Definition: Token.h:57
char * element
Definition: Token.h:56
const char * label
Definition: Token.h:50
bool zero
Definition: Token.h:65
static void Init()
Initialize the format token registrations.
Definition: Token.cc:238
int widthMin
minimum field width
Definition: Token.h:60
int widthMax
maximum field width
Definition: Token.h:61
struct Format::Token::@69 data
ByteCode_t
Definition: ByteCode.h:30

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors