]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/StringData.cc
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
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.
9 /* DEBUG: section 28 Access Control */
12 #include "acl/Checklist.h"
13 #include "acl/StringData.h"
14 #include "ConfigParser.h"
17 ACLStringData::ACLStringData(ACLStringData
const &old
) : stringValues(old
.stringValues
)
22 ACLStringData::insert(const char *value
)
24 stringValues
.insert(SBuf(value
));
28 ACLStringData::match(const SBuf
&tf
)
30 if (stringValues
.empty() || tf
.isEmpty())
33 debugs(28, 3, "aclMatchStringList: checking '" << tf
<< "'");
35 bool found
= (stringValues
.find(tf
) != stringValues
.end());
36 debugs(28, 3, "aclMatchStringList: '" << tf
<< "' " << (found
? "found" : "NOT found"));
41 // XXX: performance regression due to SBuf(char*) data-copies.
43 ACLStringData::match(char const *toFind
)
45 return match(SBuf(toFind
));
49 ACLStringData::dump() const
52 sl
.insert(sl
.end(), stringValues
.begin(), stringValues
.end());
57 ACLStringData::parse()
59 while (const char *t
= ConfigParser::strtokFile())
60 stringValues
.insert(SBuf(t
));
64 ACLStringData::empty() const
66 return stringValues
.empty();
69 ACLData
<char const *> *
70 ACLStringData::clone() const
72 /* Splay trees don't clone yet. */
73 return new ACLStringData(*this);