Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: compiled/ElemHideEmulation.h

Issue 29594607: Issue 5143 - Convert ElemHideEmulation to C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Improvements from review. Created Nov. 20, 2017, 7:15 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « compiled/ElemHide.h ('k') | compiled/ElemHideEmulation.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 ElemHideEmulation_FilterList : public ref_counted
27 {
28 std::vector<ElemHideBasePtr> mFilters;
29 public:
30 size_t BINDINGS_EXPORTED GetFilterCount() const
31 {
32 return mFilters.size();
33 }
34
35 ElemHideBase* BINDINGS_EXPORTED FilterAt(size_t index)
36 {
37 if (index >= mFilters.size())
38 return nullptr;
39
40 ElemHideBasePtr result(mFilters[index]);
41 return result.release();
42 }
43
44 void push_back(const ElemHideBasePtr& filter)
45 {
46 mFilters.push_back(filter);
47 }
48
49 };
50
51 class ElemHideEmulation : public ref_counted
52 {
53 StringMap<ElemHideBasePtr> mFilters;
54
55 static ElemHideEmulation* mInstance;
56
57 public:
58 static ElemHideEmulation* BINDINGS_EXPORTED GetInstance()
59 {
60 return mInstance;
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(DependentStr ing&);
67 };
OLDNEW
« no previous file with comments | « compiled/ElemHide.h ('k') | compiled/ElemHideEmulation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld