OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-present eyeo GmbH |
| 4 * |
| 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 |
| 7 * published by the Free Software Foundation. |
| 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 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/>. |
| 16 */ |
| 17 |
| 18 #pragma once |
| 19 |
| 20 #include <vector> |
| 21 |
| 22 #include "bindings/runtime.h" |
| 23 #include "intrusive_ptr.h" |
| 24 #include "filter/ElemHideBase.h" |
| 25 |
| 26 class ElemHide; |
| 27 |
| 28 class ElemHideEmulation_FilterList : public ref_counted |
| 29 { |
| 30 std::vector<ElemHideBasePtr> mFilters; |
| 31 public: |
| 32 size_t BINDINGS_EXPORTED GetFilterCount() const |
| 33 { |
| 34 return mFilters.size(); |
| 35 } |
| 36 |
| 37 ElemHideBase* BINDINGS_EXPORTED FilterAt(size_t index) |
| 38 { |
| 39 if (index >= mFilters.size()) |
| 40 return nullptr; |
| 41 |
| 42 ElemHideBasePtr result(mFilters[index]); |
| 43 return result.release(); |
| 44 } |
| 45 |
| 46 void push_back(const ElemHideBasePtr& filter) |
| 47 { |
| 48 mFilters.push_back(filter); |
| 49 } |
| 50 |
| 51 }; |
| 52 |
| 53 class ElemHideEmulation : public ref_counted |
| 54 { |
| 55 StringMap<ElemHideBasePtr> mFilters; |
| 56 |
| 57 public: |
| 58 static ElemHideEmulation* BINDINGS_EXPORTED Create() |
| 59 { |
| 60 return new ElemHideEmulation(); |
| 61 } |
| 62 |
| 63 void BINDINGS_EXPORTED Add(ElemHideBase&); |
| 64 void BINDINGS_EXPORTED Remove(ElemHideBase&); |
| 65 void BINDINGS_EXPORTED Clear(); |
| 66 ElemHideEmulation_FilterList* BINDINGS_EXPORTED GetRulesForDomain(const ElemHi
de&, DependentString&); |
| 67 }; |
OLD | NEW |