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

Delta Between Two Patch Sets: compiled/bindings/main.cpp

Issue 29606600: Issue 5146 - Implement DownloadableSubscription parsing in C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Added md5 checksum. Reorganized some code. Created Nov. 28, 2017, 10:46 p.m.
Right Patch Set: Removed Md5sum and associated code Created Aug. 14, 2018, 12:38 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « compiled/StringScanner.h ('k') | compiled/storage/FilterStorage.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 19 matching lines...) Expand all
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 "../ElemHideEmulation.h"
39 #include "../FilterNotifier.h" 39 #include "../FilterNotifier.h"
40
41 ABP_NS_USING
40 42
41 int main() 43 int main()
42 { 44 {
43 try 45 try
44 { 46 {
45 class_<Filter>("Filter") 47 class_<Filter>("Filter")
46 .property("text", &Filter::GetText) 48 .property("text", &Filter::GetText)
47 .function("serialize", &Filter::Serialize) 49 .function("serialize", &Filter::Serialize)
48 .class_function("fromText", &Filter::FromText) 50 .class_function("fromText", &Filter::FromText)
49 .subclass_differentiator(&Filter::mType, { 51 .subclass_differentiator(&Filter::mType, {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 .property("lastCheck", &DownloadableSubscription::GetLastCheck, &Downloa dableSubscription::SetLastCheck) 128 .property("lastCheck", &DownloadableSubscription::GetLastCheck, &Downloa dableSubscription::SetLastCheck)
127 .property("hardExpiration", &DownloadableSubscription::GetHardExpiration , &DownloadableSubscription::SetHardExpiration) 129 .property("hardExpiration", &DownloadableSubscription::GetHardExpiration , &DownloadableSubscription::SetHardExpiration)
128 .property("softExpiration", &DownloadableSubscription::GetSoftExpiration , &DownloadableSubscription::SetSoftExpiration) 130 .property("softExpiration", &DownloadableSubscription::GetSoftExpiration , &DownloadableSubscription::SetSoftExpiration)
129 .property("lastDownload", &DownloadableSubscription::GetLastDownload, &D ownloadableSubscription::SetLastDownload) 131 .property("lastDownload", &DownloadableSubscription::GetLastDownload, &D ownloadableSubscription::SetLastDownload)
130 .property("downloadStatus", &DownloadableSubscription::GetDownloadStatus , &DownloadableSubscription::SetDownloadStatus) 132 .property("downloadStatus", &DownloadableSubscription::GetDownloadStatus , &DownloadableSubscription::SetDownloadStatus)
131 .property("lastSuccess", &DownloadableSubscription::GetLastSuccess, &Dow nloadableSubscription::SetLastSuccess) 133 .property("lastSuccess", &DownloadableSubscription::GetLastSuccess, &Dow nloadableSubscription::SetLastSuccess)
132 .property("errorCount", &DownloadableSubscription::GetErrorCount, &Downl oadableSubscription::SetErrorCount) 134 .property("errorCount", &DownloadableSubscription::GetErrorCount, &Downl oadableSubscription::SetErrorCount)
133 .property("dataRevision", &DownloadableSubscription::GetDataRevision, &D ownloadableSubscription::SetDataRevision) 135 .property("dataRevision", &DownloadableSubscription::GetDataRevision, &D ownloadableSubscription::SetDataRevision)
134 .property("requiredVersion", &DownloadableSubscription::GetRequiredVersi on, &DownloadableSubscription::SetRequiredVersion) 136 .property("requiredVersion", &DownloadableSubscription::GetRequiredVersi on, &DownloadableSubscription::SetRequiredVersion)
135 .property("downloadCount", &DownloadableSubscription::GetDownloadCount, &DownloadableSubscription::SetDownloadCount) 137 .property("downloadCount", &DownloadableSubscription::GetDownloadCount, &DownloadableSubscription::SetDownloadCount)
136 .function("parseDownload", &DownloadableSubscription::ParseDownload) 138 .class_function("parseDownload", &DownloadableSubscription::ParseDownloa d)
137 .function("serialize", &DownloadableSubscription::Serialize); 139 .function("serialize", &DownloadableSubscription::Serialize);
138 140
139 class_<DownloadableSubscription_Parser>("DownloadableSubscription_Parser") 141 class_<DownloadableSubscription_Parser>("DownloadableSubscription_Parser")
140 .property("redirect", &DownloadableSubscription_Parser::GetRedirect) 142 .property("redirect", &DownloadableSubscription_Parser::GetRedirect)
141 .property("homepage", &DownloadableSubscription_Parser::GetHomepage) 143 .property("homepage", &DownloadableSubscription_Parser::GetHomepage)
142 .function("process", &DownloadableSubscription_Parser::Process) 144 .function("process", &DownloadableSubscription_Parser::Process)
143 .function("finalize", &DownloadableSubscription_Parser::Finalize); 145 .function("finalize", &DownloadableSubscription_Parser::Finalize);
144 146
145 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) 147 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance)
146 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) 148 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount)
147 .function("subscriptionAt", &FilterStorage::SubscriptionAt) 149 .function("subscriptionAt", &FilterStorage::SubscriptionAt)
148 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) 150 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription)
149 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter) 151 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter)
150 .function("addSubscription", &FilterStorage::AddSubscription) 152 .function("addSubscription", &FilterStorage::AddSubscription)
151 .function("removeSubscription", &FilterStorage::RemoveSubscription) 153 .function("removeSubscription", &FilterStorage::RemoveSubscription)
152 .function("moveSubscription", &FilterStorage::MoveSubscription); 154 .function("moveSubscription", &FilterStorage::MoveSubscription)
155 .function("clearSubscriptionFilters", &FilterStorage::ClearSubscriptionF ilters);
153 156
154 class_<ElemHide_SelectorList>("ElemHide_SelectorList") 157 class_<ElemHide_SelectorList>("ElemHide_SelectorList")
155 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount) 158 .property("selectorCount", &ElemHide_SelectorList::GetSelectorCount)
156 .function("selectorAt", &ElemHide_SelectorList::SelectorAt) 159 .function("selectorAt", &ElemHide_SelectorList::SelectorAt)
157 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt); 160 .function("filterKeyAt", &ElemHide_SelectorList::FilterKeyAt);
158 161
159 singleton<ElemHide>("ElemHide", &ElemHide::GetInstance) 162 class_<ElemHide>("ElemHide")
163 .class_function("create", &ElemHide::Create)
160 .function("add", &ElemHide::Add) 164 .function("add", &ElemHide::Add)
161 .function("remove", &ElemHide::Remove) 165 .function("remove", &ElemHide::Remove)
162 .function("clear", &ElemHide::Clear) 166 .function("clear", &ElemHide::Clear)
163 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain) 167 .function("getSelectorsForDomain", &ElemHide::GetSelectorsForDomain)
164 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect ors); 168 .function("getUnconditionalSelectors", &ElemHide::GetUnconditionalSelect ors);
165 169
166 class_<ElemHideEmulation_FilterList>("ElemHideEmulation_FilterList") 170 class_<ElemHideEmulation_FilterList>("ElemHideEmulation_FilterList")
167 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount) 171 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount)
168 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt); 172 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt);
169 173
170 singleton<ElemHideEmulation>("ElemHideEmulation", &ElemHideEmulation::GetIns tance) 174 class_<ElemHideEmulation>("ElemHideEmulation")
175 .class_function("create", &ElemHideEmulation::Create)
171 .function("add", &ElemHideEmulation::Add) 176 .function("add", &ElemHideEmulation::Add)
172 .function("remove", &ElemHideEmulation::Remove) 177 .function("remove", &ElemHideEmulation::Remove)
173 .function("clear", &ElemHideEmulation::Clear) 178 .function("clear", &ElemHideEmulation::Clear)
174 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain); 179 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain);
175 180
176 printBindings(); 181 printBindings();
177 RegExpFilter::GenerateCustomBindings(); 182 RegExpFilter::GenerateCustomBindings();
178 FilterNotifier::GenerateCustomBindings(); 183 FilterNotifier::GenerateCustomBindings::Generate();
179 184
180 return 0; 185 return 0;
181 } 186 }
182 catch (const std::exception& e) 187 catch (const std::exception& e)
183 { 188 {
184 EM_ASM_ARGS( 189 EM_ASM_ARGS(
185 console.error("Error occurred generating JavaScript bindings: " + 190 console.error("Error occurred generating JavaScript bindings: " +
186 Module.AsciiToString($0)), e.what() 191 Module.AsciiToString($0)), e.what()
187 ); 192 );
188 return 1; 193 return 1;
189 } 194 }
190 } 195 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld