source: squid-ssl/trunk/fuentes/src/acl/StringData.cc @ 5495

Last change on this file since 5495 was 5495, checked in by Juanma, 2 years ago

Initial release

File size: 1.4 KB
Line 
1/*
2 * Copyright (C) 1996-2015 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 "cache_cf.h"
15#include "Debug.h"
16
17ACLStringData::ACLStringData(ACLStringData const &old) : stringValues(old.stringValues)
18{
19}
20
21void
22ACLStringData::insert(const char *value)
23{
24    stringValues.insert(SBuf(value));
25}
26
27bool
28ACLStringData::match(char const *toFind)
29{
30    if (stringValues.empty() || !toFind)
31        return 0;
32
33    SBuf tf(toFind);
34    debugs(28, 3, "aclMatchStringList: checking '" << tf << "'");
35
36    bool found = (stringValues.find(tf) != stringValues.end());
37    debugs(28, 3, "aclMatchStringList: '" << tf << "' " << (found ? "found" : "NOT found"));
38
39    return found;
40}
41
42SBufList
43ACLStringData::dump() const
44{
45    SBufList sl;
46    sl.insert(sl.end(), stringValues.begin(), stringValues.end());
47    return sl;
48}
49
50void
51ACLStringData::parse()
52{
53    char *t;
54    while ((t = strtokFile()))
55        stringValues.insert(SBuf(t));
56}
57
58bool
59ACLStringData::empty() const
60{
61    return stringValues.empty();
62}
63
64ACLData<char const *> *
65ACLStringData::clone() const
66{
67    /* Splay trees don't clone yet. */
68    return new ACLStringData(*this);
69}
70
Note: See TracBrowser for help on using the repository browser.