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 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // Remove trailing spaces | 65 // Remove trailing spaces |
66 for (; end > 0; end--) | 66 for (; end > 0; end--) |
67 if (text[end - 1] != ' ') | 67 if (text[end - 1] != ' ') |
68 break; | 68 break; |
69 | 69 |
70 // Set new string boundaries | 70 // Set new string boundaries |
71 text.reset(text, start, end - start); | 71 text.reset(text, start, end - start); |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
| 75 const DependentString Filter::regexpRegExp = u"^(@@)?\\/.*\\/(?:\\$~?[\\w-]+(?:=
[^,\\s]+)?(?:,~?[\\w-]+(?:=[^,\\s]+)?)*)?$"_str; |
| 76 const DependentString Filter::optionsRegExp = u"\\$(~?[\\w-]+(?:=[^,\\s]+)?(?:,~
?[\\w-]+(?:=[^,\\s]+)?)*)$"_str; |
| 77 |
75 Filter::Filter(Type type, const String& text) | 78 Filter::Filter(Type type, const String& text) |
76 : mText(text), mType(type) | 79 : mText(text), mType(type) |
77 { | 80 { |
78 annotate_address(this, "Filter"); | 81 annotate_address(this, "Filter"); |
79 } | 82 } |
80 | 83 |
81 Filter::~Filter() | 84 Filter::~Filter() |
82 { | 85 { |
83 knownFilters.erase(mText); | 86 knownFilters.erase(mText); |
84 } | 87 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 155 |
153 // This is a hack: we looked up the entry using text but create it using | 156 // 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, | 157 // filter->mText. This works because both are equal at this point. However, |
155 // text refers to a temporary buffer which will go away. | 158 // text refers to a temporary buffer which will go away. |
156 enter_context("Adding to known filters"); | 159 enter_context("Adding to known filters"); |
157 knownFilter.assign(filter->mText, filter.get()); | 160 knownFilter.assign(filter->mText, filter.get()); |
158 exit_context(); | 161 exit_context(); |
159 | 162 |
160 return filter.release(); | 163 return filter.release(); |
161 } | 164 } |
OLD | NEW |