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: Rebased. Created Dec. 5, 2017, 6:03 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
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 146
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 singleton<ElemHide>("ElemHide", &ElemHide::GetInstance) 152 singleton<ElemHide>("ElemHide", &ElemHide::GetInstance)
152 .function("add", &ElemHide::Add) 153 .function("add", &ElemHide::Add)
153 .function("remove", &ElemHide::Remove) 154 .function("remove", &ElemHide::Remove)
154 .function("clear", &ElemHide::Clear) 155 .function("clear", &ElemHide::Clear)
155 .function("getException", &ElemHide::GetException)
156 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain) 156 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain)
157 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect ors); 157 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect ors);
158 158
159 class_<ElemHideEmulation_FilterList>("ElemHideEmulation_FilterList")
160 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount)
161 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt);
162
163 singleton<ElemHideEmulation>("ElemHideEmulation", &ElemHideEmulation::GetIns tance)
164 .function("add", &ElemHideEmulation::Add)
165 .function("remove", &ElemHideEmulation::Remove)
166 .function("clear", &ElemHideEmulation::Clear)
167 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain);
168
159 printBindings(); 169 printBindings();
160 RegExpFilter::GenerateCustomBindings(); 170 RegExpFilter::GenerateCustomBindings();
161 FilterNotifier::GenerateCustomBindings(); 171 FilterNotifier::GenerateCustomBindings();
162 172
163 return 0; 173 return 0;
164 } 174 }
165 catch (const std::exception& e) 175 catch (const std::exception& e)
166 { 176 {
167 EM_ASM_ARGS( 177 EM_ASM_ARGS(
168 console.error("Error occurred generating JavaScript bindings: " + 178 console.error("Error occurred generating JavaScript bindings: " +
169 Module.AsciiToString($0)), e.what() 179 Module.AsciiToString($0)), e.what()
170 ); 180 );
171 return 1; 181 return 1;
172 } 182 }
173 } 183 }
OLDNEW

Powered by Google App Engine
This is Rietveld