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: Review comments addressed Created Jan. 30, 2018, 5:37 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 class_<ElemHide_SelectorList>("ElemHide_SelectorList") 147 class_<ElemHide_SelectorList>("ElemHide_SelectorList")
147 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount) 148 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount)
148 .function("selectorAt", &ElemHide_SelectorList::SelectorAt) 149 .function("selectorAt", &ElemHide_SelectorList::SelectorAt)
149 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt); 150 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt);
150 151
151 class_<ElemHide>("ElemHide") 152 class_<ElemHide>("ElemHide")
152 .class_function("create", &ElemHide::Create) 153 .class_function("create", &ElemHide::Create)
153 .function("add", &ElemHide::Add) 154 .function("add", &ElemHide::Add)
154 .function("remove", &ElemHide::Remove) 155 .function("remove", &ElemHide::Remove)
155 .function("clear", &ElemHide::Clear) 156 .function("clear", &ElemHide::Clear)
156 .function("getException", &ElemHide::GetException)
157 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain) 157 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain)
158 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect ors); 158 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect ors);
159 159
160 class_<ElemHideEmulation_FilterList>("ElemHideEmulation_FilterList")
161 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount)
162 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt);
163
164 class_<ElemHideEmulation>("ElemHideEmulation")
165 .class_function("create", &ElemHideEmulation::Create)
166 .function("add", &ElemHideEmulation::Add)
167 .function("remove", &ElemHideEmulation::Remove)
168 .function("clear", &ElemHideEmulation::Clear)
169 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain);
170
160 printBindings(); 171 printBindings();
161 RegExpFilter::GenerateCustomBindings(); 172 RegExpFilter::GenerateCustomBindings();
162 FilterNotifier::GenerateCustomBindings(); 173 FilterNotifier::GenerateCustomBindings();
163 174
164 return 0; 175 return 0;
165 } 176 }
166 catch (const std::exception& e) 177 catch (const std::exception& e)
167 { 178 {
168 EM_ASM_ARGS( 179 EM_ASM_ARGS(
169 console.error("Error occurred generating JavaScript bindings: " + 180 console.error("Error occurred generating JavaScript bindings: " +
170 Module.AsciiToString($0)), e.what() 181 Module.AsciiToString($0)), e.what()
171 ); 182 );
172 return 1; 183 return 1;
173 } 184 }
174 } 185 }
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