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: Rebase. Review comments addressed. Created Jan. 25, 2018, 7:04 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
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 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 static ElemHideEmulation* mInstance;
sergei 2018/01/30 16:00:47 It's not used, could you please remove it?
hub 2018/01/30 17:37:58 Done.
58
59 public:
60 static ElemHideEmulation* BINDINGS_EXPORTED Create()
61 {
62 return new ElemHideEmulation();
63 }
64
65 void BINDINGS_EXPORTED Add(ElemHideBase&);
66 void BINDINGS_EXPORTED Remove(ElemHideBase&);
67 void BINDINGS_EXPORTED Clear();
68 ElemHideEmulation_FilterList* BINDINGS_EXPORTED GetRulesForDomain(const ElemHi de&, DependentString&);
69 };
OLDNEW

Powered by Google App Engine
This is Rietveld