| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 UserDefinedSubscription::UserDefinedSubscription(const String& id) | 50 UserDefinedSubscription::UserDefinedSubscription(const String& id) |
| 51 : Subscription(Type::USERDEFINED, id), mDefaults(0) | 51 : Subscription(Type::USERDEFINED, id), mDefaults(0) |
| 52 { | 52 { |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool UserDefinedSubscription::IsDefaultFor(const Filter& filter) const | 55 bool UserDefinedSubscription::IsDefaultFor(const Filter& filter) const |
| 56 { | 56 { |
| 57 if (filter.mType >= Filter::Type::VALUE_COUNT) | 57 if (filter.mType >= Filter::Type::VALUE_COUNT) |
| 58 { | 58 { |
| 59 assert2(false, "Filter type exceeds valid range"); | 59 assert2(false, u"Filter type exceeds valid range"_str); |
| 60 abort(); | 60 abort(); |
| 61 } | 61 } |
| 62 return mDefaults & filterTypeToCategory[filter.mType]; | 62 return mDefaults & filterTypeToCategory[filter.mType]; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void UserDefinedSubscription::MakeDefaultFor(const Filter& filter) | 65 void UserDefinedSubscription::MakeDefaultFor(const Filter& filter) |
| 66 { | 66 { |
| 67 if (filter.mType >= Filter::Type::VALUE_COUNT) | 67 if (filter.mType >= Filter::Type::VALUE_COUNT) |
| 68 { | 68 { |
| 69 assert2(false, "Filter type exceeds valid range"); | 69 assert2(false, u"Filter type exceeds valid range"_str); |
| 70 abort(); | 70 abort(); |
| 71 } | 71 } |
| 72 mDefaults |= filterTypeToCategory[filter.mType]; | 72 mDefaults |= filterTypeToCategory[filter.mType]; |
| 73 } | 73 } |
| 74 | 74 |
| 75 void UserDefinedSubscription::InsertFilterAt(Filter& filter, unsigned pos) | 75 void UserDefinedSubscription::InsertFilterAt(Filter& filter, unsigned pos) |
| 76 { | 76 { |
| 77 if (pos >= mFilters.size()) | 77 if (pos >= mFilters.size()) |
| 78 pos = mFilters.size(); | 78 pos = mFilters.size(); |
| 79 mFilters.emplace(mFilters.begin() + pos, &filter); | 79 mFilters.emplace(mFilters.begin() + pos, &filter); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 109 if (mDefaults & FilterCategory::BLOCKING) | 109 if (mDefaults & FilterCategory::BLOCKING) |
| 110 result.append(u" blocking"_str); | 110 result.append(u" blocking"_str); |
| 111 if (mDefaults & FilterCategory::WHITELIST) | 111 if (mDefaults & FilterCategory::WHITELIST) |
| 112 result.append(u" whitelist"_str); | 112 result.append(u" whitelist"_str); |
| 113 if (mDefaults & FilterCategory::ELEMHIDE) | 113 if (mDefaults & FilterCategory::ELEMHIDE) |
| 114 result.append(u" elemhide"_str); | 114 result.append(u" elemhide"_str); |
| 115 result.append(u'\n'); | 115 result.append(u'\n'); |
| 116 } | 116 } |
| 117 return result; | 117 return result; |
| 118 } | 118 } |
| OLD | NEW |