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

Side by Side Diff: compiled/bindings/main.cpp

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/ElemHideEmulation.cpp ('k') | lib/elemHideEmulation.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
28 #include "../filter/WhitelistFilter.h" 28 #include "../filter/WhitelistFilter.h"
29 #include "../filter/ElemHideBase.h" 29 #include "../filter/ElemHideBase.h"
30 #include "../filter/ElemHideFilter.h" 30 #include "../filter/ElemHideFilter.h"
31 #include "../filter/ElemHideException.h" 31 #include "../filter/ElemHideException.h"
32 #include "../filter/ElemHideEmulationFilter.h" 32 #include "../filter/ElemHideEmulationFilter.h"
33 #include "../subscription/Subscription.h" 33 #include "../subscription/Subscription.h"
34 #include "../subscription/DownloadableSubscription.h" 34 #include "../subscription/DownloadableSubscription.h"
35 #include "../subscription/UserDefinedSubscription.h" 35 #include "../subscription/UserDefinedSubscription.h"
36 #include "../storage/FilterStorage.h" 36 #include "../storage/FilterStorage.h"
37 #include "../ElemHide.h" 37 #include "../ElemHide.h"
38 #include "../ElemHideEmulation.h"
38 #include "../FilterNotifier.h" 39 #include "../FilterNotifier.h"
39 40
40 int main() 41 int main()
41 { 42 {
42 try 43 try
43 { 44 {
44 class_<Filter>("Filter") 45 class_<Filter>("Filter")
45 .property("text", &Filter::GetText) 46 .property("text", &Filter::GetText)
46 .function("serialize", &Filter::Serialize) 47 .function("serialize", &Filter::Serialize)
47 .class_function("fromText", &Filter::FromText) 48 .class_function("fromText", &Filter::FromText)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 144
144 class_<_ElemHide_SelectorList>("_ElemHide_SelectorList") 145 class_<_ElemHide_SelectorList>("_ElemHide_SelectorList")
145 .property("selectorCount", &_ElemHide_SelectorList::GetSelectorCount) 146 .property("selectorCount", &_ElemHide_SelectorList::GetSelectorCount)
146 .function("selectorAt", &_ElemHide_SelectorList::SelectorAt) 147 .function("selectorAt", &_ElemHide_SelectorList::SelectorAt)
147 .function("filterKeyAt", &_ElemHide_SelectorList::FilterKeyAt); 148 .function("filterKeyAt", &_ElemHide_SelectorList::FilterKeyAt);
148 149
149 singleton<ElemHide>("ElemHide", &ElemHide::GetInstance) 150 singleton<ElemHide>("ElemHide", &ElemHide::GetInstance)
150 .function("add", &ElemHide::Add) 151 .function("add", &ElemHide::Add)
151 .function("remove", &ElemHide::Remove) 152 .function("remove", &ElemHide::Remove)
152 .function("clear", &ElemHide::Clear) 153 .function("clear", &ElemHide::Clear)
153 .function("getException", &ElemHide::GetException)
154 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain) 154 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain)
155 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect ors); 155 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect ors);
156 156
157 class_<ElemHideEmulation_FilterList>("ElemHideEmulation_FilterList")
158 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount)
159 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt);
160
161 singleton<ElemHideEmulation>("ElemHideEmulation", &ElemHideEmulation::GetIns tance)
162 .function("add", &ElemHideEmulation::Add)
163 .function("remove", &ElemHideEmulation::Remove)
164 .function("clear", &ElemHideEmulation::Clear)
165 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain);
166
157 printBindings(); 167 printBindings();
158 RegExpFilter::GenerateCustomBindings(); 168 RegExpFilter::GenerateCustomBindings();
159 FilterNotifier::GenerateCustomBindings(); 169 FilterNotifier::GenerateCustomBindings();
160 170
161 return 0; 171 return 0;
162 } 172 }
163 catch (const std::exception& e) 173 catch (const std::exception& e)
164 { 174 {
165 EM_ASM_ARGS( 175 EM_ASM_ARGS(
166 console.error("Error occurred generating JavaScript bindings: " + 176 console.error("Error occurred generating JavaScript bindings: " +
167 Module.AsciiToString($0)), e.what() 177 Module.AsciiToString($0)), e.what()
168 ); 178 );
169 return 1; 179 return 1;
170 } 180 }
171 } 181 }
OLDNEW
« no previous file with comments | « compiled/ElemHideEmulation.cpp ('k') | lib/elemHideEmulation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld