NoteData.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2022 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 #include "squid.h"
10 #include "acl/Acl.h"
11 #include "acl/Checklist.h"
12 #include "acl/NoteData.h"
13 #include "acl/StringData.h"
14 #include "ConfigParser.h"
15 #include "debug/Stream.h"
16 #include "sbuf/StringConvert.h"
17 #include "wordlist.h"
18 
20 {}
21 
23 {
24  delete values;
25 }
26 
27 bool
29 {
30  if (entry->name().cmp(name) != 0)
31  return false; // name mismatch
32 
33  // a name-only note ACL matches any value; others require a values match
34  return values->empty() ||
35  values->match(entry->value());
36 }
37 
40 {
41  SBufList sl;
42  sl.push_back(name);
43  sl.splice(sl.end(), values->dump());
44  return sl;
45 }
46 
47 void
49 {
50  char* t = ConfigParser::strtokFile();
51  assert (t != nullptr);
52  name = t;
53  values->parse();
54 }
55 
56 bool
58 {
59  return name.isEmpty();
60 }
61 
#define assert(EX)
Definition: assert.h:19
virtual bool match(NotePairs::Entry *)
Definition: NoteData.cc:28
ACLStringData * values
if set, at least one value must match
Definition: NoteData.h:33
virtual ~ACLNoteData()
Definition: NoteData.cc:22
virtual void parse()
Definition: NoteData.cc:48
virtual bool empty() const
Definition: NoteData.cc:57
virtual SBufList dump() const
Definition: NoteData.cc:39
SBuf name
Note name to check. It is always set.
Definition: NoteData.h:32
virtual SBufList dump() const
Definition: StringData.cc:45
bool match(char const *)
Definition: StringData.cc:39
virtual void parse()
Definition: StringData.cc:53
bool empty() const
Definition: StringData.cc:60
static char * strtokFile()
Definition: ConfigParser.cc:64
Used to store a note key/value pair.
Definition: Notes.h:179
const SBuf & value() const
Definition: Notes.h:192
const SBuf & name() const
Definition: Notes.h:191
int cmp(const SBuf &S, const size_type n) const
shorthand version for compare()
Definition: SBuf.h:275
bool isEmpty() const
Definition: SBuf.h:431
std::list< SBuf > SBufList
Definition: forward.h:22

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors