OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 #include "Filter.h" | 18 #include "Filter.h" |
19 #include "CommentFilter.h" | 19 #include "CommentFilter.h" |
20 #include "InvalidFilter.h" | 20 #include "InvalidFilter.h" |
21 #include "RegExpFilter.h" | 21 #include "RegExpFilter.h" |
22 #include "BlockingFilter.h" | 22 #include "BlockingFilter.h" |
23 #include "WhitelistFilter.h" | 23 #include "WhitelistFilter.h" |
24 #include "ElemHideBase.h" | 24 #include "ElemHideBase.h" |
25 #include "ElemHideFilter.h" | 25 #include "ElemHideFilter.h" |
26 #include "ElemHideException.h" | 26 #include "ElemHideException.h" |
27 #include "ElemHideEmulationFilter.h" | 27 #include "ElemHideEmulationFilter.h" |
28 #include "../StringMap.h" | 28 #include "../StringMap.h" |
29 | 29 |
| 30 ABP_NS_USING |
| 31 |
30 namespace | 32 namespace |
31 { | 33 { |
32 StringMap<Filter*> knownFilters(8192); | 34 StringMap<Filter*> knownFilters(8192); |
33 | 35 |
34 void NormalizeWhitespace(DependentString& text) | 36 void NormalizeWhitespace(DependentString& text) |
35 { | 37 { |
36 String::size_type start = 0; | 38 String::size_type start = 0; |
37 String::size_type end = text.length(); | 39 String::size_type end = text.length(); |
38 | 40 |
39 // Remove leading spaces and special characters like line breaks | 41 // Remove leading spaces and special characters like line breaks |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 154 |
153 // This is a hack: we looked up the entry using text but create it using | 155 // This is a hack: we looked up the entry using text but create it using |
154 // filter->mText. This works because both are equal at this point. However, | 156 // filter->mText. This works because both are equal at this point. However, |
155 // text refers to a temporary buffer which will go away. | 157 // text refers to a temporary buffer which will go away. |
156 enter_context("Adding to known filters"); | 158 enter_context("Adding to known filters"); |
157 knownFilter.assign(filter->mText, filter.get()); | 159 knownFilter.assign(filter->mText, filter.get()); |
158 exit_context(); | 160 exit_context(); |
159 | 161 |
160 return filter.release(); | 162 return filter.release(); |
161 } | 163 } |
OLD | NEW |