Squid Web Cache master
Loading...
Searching...
No Matches
StringData.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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/* DEBUG: section 28 Access Control */
10
11#include "squid.h"
12#include "acl/Checklist.h"
13#include "acl/StringData.h"
14#include "ConfigParser.h"
15#include "debug/Stream.h"
16
17void
18ACLStringData::insert(const char *value)
19{
20 stringValues.insert(SBuf(value));
21}
22
23bool
25{
26 if (stringValues.empty())
27 return 0;
28
29 debugs(28, 3, "aclMatchStringList: checking '" << tf << "'");
30
31 bool found = (stringValues.find(tf) != stringValues.end());
32 debugs(28, 3, "aclMatchStringList: '" << tf << "' " << (found ? "found" : "NOT found"));
33
34 return found;
35}
36
37// XXX: performance regression due to SBuf(char*) data-copies.
38bool
39ACLStringData::match(char const *toFind)
40{
41 if (!toFind) {
42 // TODO: Check whether we can Assure(toFind) instead.
43 debugs(28, 3, "not matching a nil c-string");
44 return false;
45 }
46 return match(SBuf(toFind));
47}
48
51{
52 SBufList sl;
53 sl.insert(sl.end(), stringValues.begin(), stringValues.end());
54 return sl;
55}
56
57void
59{
60 while (const char *t = ConfigParser::strtokFile())
61 stringValues.insert(SBuf(t));
62}
63
64bool
66{
67 return stringValues.empty();
68}
69
bool match(char const *) override
Definition StringData.cc:39
void insert(const char *)
Insert a string data value.
Definition StringData.cc:18
bool empty() const override
Definition StringData.cc:65
StringValues_t stringValues
Definition StringData.h:37
void parse() override
Definition StringData.cc:58
SBufList dump() const override
Definition StringData.cc:50
static char * strtokFile()
Definition SBuf.h:94
#define debugs(SECTION, LEVEL, CONTENT)
Definition Stream.h:192
std::list< SBuf > SBufList
Definition forward.h:23