]>
Commit | Line | Data |
---|---|---|
bbc27441 | 1 | /* |
ef57eb7b | 2 | * Copyright (C) 1996-2016 The Squid Software Foundation and contributors |
bbc27441 AJ |
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 | ||
39baccc8 CT |
9 | #include "squid.h" |
10 | #include "acl/Acl.h" | |
11 | #include "acl/Checklist.h" | |
12 | #include "acl/NoteData.h" | |
13 | #include "acl/StringData.h" | |
39baccc8 CT |
14 | #include "ConfigParser.h" |
15 | #include "Debug.h" | |
39baccc8 CT |
16 | #include "wordlist.h" |
17 | ||
18 | ACLNoteData::ACLNoteData() : values(new ACLStringData) | |
19 | {} | |
20 | ||
21 | ACLNoteData::~ACLNoteData() | |
22 | { | |
23 | delete values; | |
24 | } | |
25 | ||
26 | bool | |
76ee67ac | 27 | ACLNoteData::match(NotePairs::Entry *entry) |
39baccc8 | 28 | { |
76ee67ac | 29 | return !entry->name.cmp(name.termedBuf()) && values->match(entry->value.termedBuf()); |
39baccc8 CT |
30 | } |
31 | ||
9b859d6f | 32 | SBufList |
4f8ca96e | 33 | ACLNoteData::dump() const |
39baccc8 | 34 | { |
9b859d6f FC |
35 | SBufList sl; |
36 | sl.push_back(SBuf(name)); | |
524f5ff6 AJ |
37 | #if __cplusplus >= 201103L |
38 | sl.splice(sl.end(), values->dump()); | |
39 | #else | |
7d75c222 FC |
40 | // temp is needed until c++11 move constructor |
41 | SBufList temp = values->dump(); | |
42 | sl.splice(sl.end(), temp); | |
524f5ff6 | 43 | #endif |
9b859d6f | 44 | return sl; |
39baccc8 CT |
45 | } |
46 | ||
47 | void | |
48 | ACLNoteData::parse() | |
49 | { | |
16c5ad96 | 50 | char* t = ConfigParser::strtokFile(); |
39baccc8 CT |
51 | assert (t != NULL); |
52 | name = t; | |
53 | values->parse(); | |
54 | } | |
55 | ||
56 | bool | |
57 | ACLNoteData::empty() const | |
58 | { | |
a1377698 | 59 | return name.size() == 0; |
39baccc8 CT |
60 | } |
61 | ||
76ee67ac | 62 | ACLData<NotePairs::Entry *> * |
39baccc8 CT |
63 | ACLNoteData::clone() const |
64 | { | |
65 | ACLNoteData * result = new ACLNoteData; | |
76ee67ac CT |
66 | result->values = dynamic_cast<ACLStringData*>(values->clone()); |
67 | assert(result->values); | |
39baccc8 CT |
68 | result->name = name; |
69 | return result; | |
70 | } | |
f53969cc | 71 |