OLD | NEW |
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 Loading... |
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 #include "../storage/Parser.h" |
| 41 #include "../storage/Serializer.h" |
40 | 42 |
41 ABP_NS_USING | 43 ABP_NS_USING |
42 | 44 |
43 int main() | 45 int main() |
44 { | 46 { |
45 try | 47 try |
46 { | 48 { |
47 class_<Filter>("Filter") | 49 class_<Filter>("Filter") |
48 .property("text", &Filter::GetText) | 50 .property("text", &Filter::GetText) |
49 .function("serialize", &Filter::Serialize) | 51 .function("serialize", &Filter::Serialize) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 .class_property("type", "'elemhideemulation'"); | 101 .class_property("type", "'elemhideemulation'"); |
100 | 102 |
101 class_<Subscription>("Subscription") | 103 class_<Subscription>("Subscription") |
102 .property("url", &Subscription::GetID) | 104 .property("url", &Subscription::GetID) |
103 .property("title", &Subscription::GetTitle, &Subscription::SetTitle) | 105 .property("title", &Subscription::GetTitle, &Subscription::SetTitle) |
104 .property("disabled", &Subscription::GetDisabled, &Subscription::SetDisa
bled) | 106 .property("disabled", &Subscription::GetDisabled, &Subscription::SetDisa
bled) |
105 .property("listed", &Subscription::GetListed) | 107 .property("listed", &Subscription::GetListed) |
106 .property("filterCount", &Subscription::GetFilterCount) | 108 .property("filterCount", &Subscription::GetFilterCount) |
107 .function("filterAt", &Subscription::FilterAt) | 109 .function("filterAt", &Subscription::FilterAt) |
108 .function("indexOfFilter", &Subscription::IndexOfFilter) | 110 .function("indexOfFilter", &Subscription::IndexOfFilter) |
109 .function("serialize", &Subscription::Serialize) | |
110 .function("serializeFilters", &Subscription::SerializeFilters) | |
111 .class_function("fromURL", &Subscription::FromID) | 111 .class_function("fromURL", &Subscription::FromID) |
112 .subclass_differentiator(&Subscription::mType, { | 112 .subclass_differentiator(&Subscription::mType, { |
113 {Subscription::Type::USERDEFINED, "UserDefinedSubscription"}, | 113 {Subscription::Type::USERDEFINED, "UserDefinedSubscription"}, |
114 {Subscription::Type::DOWNLOADABLE, "DownloadableSubscription"}, | 114 {Subscription::Type::DOWNLOADABLE, "DownloadableSubscription"}, |
115 }); | 115 }); |
116 | 116 |
117 class_<UserDefinedSubscription,Subscription>("UserDefinedSubscription") | 117 class_<UserDefinedSubscription,Subscription>("UserDefinedSubscription") |
118 .function("isDefaultFor", &UserDefinedSubscription::IsDefaultFor) | 118 .function("isDefaultFor", &UserDefinedSubscription::IsDefaultFor) |
119 .function("makeDefaultFor", &UserDefinedSubscription::MakeDefaultFor) | 119 .function("makeDefaultFor", &UserDefinedSubscription::MakeDefaultFor) |
120 .function("isGeneric", &UserDefinedSubscription::IsGeneric) | 120 .function("isGeneric", &UserDefinedSubscription::IsGeneric) |
121 .function("insertFilterAt", &UserDefinedSubscription::InsertFilterAt) | 121 .function("insertFilterAt", &UserDefinedSubscription::InsertFilterAt) |
122 .function("removeFilterAt", &UserDefinedSubscription::RemoveFilterAt) | 122 .function("removeFilterAt", &UserDefinedSubscription::RemoveFilterAt); |
123 .function("serialize", &UserDefinedSubscription::Serialize); | |
124 | 123 |
125 class_<DownloadableSubscription,Subscription>("DownloadableSubscription") | 124 class_<DownloadableSubscription,Subscription>("DownloadableSubscription") |
126 .property("fixedTitle", &DownloadableSubscription::GetFixedTitle, &Downl
oadableSubscription::SetFixedTitle) | 125 .property("fixedTitle", &DownloadableSubscription::GetFixedTitle, &Downl
oadableSubscription::SetFixedTitle) |
127 .property("homepage", &DownloadableSubscription::GetHomepage, &Downloada
bleSubscription::SetHomepage) | 126 .property("homepage", &DownloadableSubscription::GetHomepage, &Downloada
bleSubscription::SetHomepage) |
128 .property("lastCheck", &DownloadableSubscription::GetLastCheck, &Downloa
dableSubscription::SetLastCheck) | 127 .property("lastCheck", &DownloadableSubscription::GetLastCheck, &Downloa
dableSubscription::SetLastCheck) |
129 .property("hardExpiration", &DownloadableSubscription::GetHardExpiration
, &DownloadableSubscription::SetHardExpiration) | 128 .property("hardExpiration", &DownloadableSubscription::GetHardExpiration
, &DownloadableSubscription::SetHardExpiration) |
130 .property("softExpiration", &DownloadableSubscription::GetSoftExpiration
, &DownloadableSubscription::SetSoftExpiration) | 129 .property("softExpiration", &DownloadableSubscription::GetSoftExpiration
, &DownloadableSubscription::SetSoftExpiration) |
131 .property("lastDownload", &DownloadableSubscription::GetLastDownload, &D
ownloadableSubscription::SetLastDownload) | 130 .property("lastDownload", &DownloadableSubscription::GetLastDownload, &D
ownloadableSubscription::SetLastDownload) |
132 .property("downloadStatus", &DownloadableSubscription::GetDownloadStatus
, &DownloadableSubscription::SetDownloadStatus) | 131 .property("downloadStatus", &DownloadableSubscription::GetDownloadStatus
, &DownloadableSubscription::SetDownloadStatus) |
133 .property("lastSuccess", &DownloadableSubscription::GetLastSuccess, &Dow
nloadableSubscription::SetLastSuccess) | 132 .property("lastSuccess", &DownloadableSubscription::GetLastSuccess, &Dow
nloadableSubscription::SetLastSuccess) |
134 .property("errorCount", &DownloadableSubscription::GetErrorCount, &Downl
oadableSubscription::SetErrorCount) | 133 .property("errorCount", &DownloadableSubscription::GetErrorCount, &Downl
oadableSubscription::SetErrorCount) |
135 .property("dataRevision", &DownloadableSubscription::GetDataRevision, &D
ownloadableSubscription::SetDataRevision) | 134 .property("dataRevision", &DownloadableSubscription::GetDataRevision, &D
ownloadableSubscription::SetDataRevision) |
136 .property("requiredVersion", &DownloadableSubscription::GetRequiredVersi
on, &DownloadableSubscription::SetRequiredVersion) | 135 .property("requiredVersion", &DownloadableSubscription::GetRequiredVersi
on, &DownloadableSubscription::SetRequiredVersion) |
137 .property("downloadCount", &DownloadableSubscription::GetDownloadCount,
&DownloadableSubscription::SetDownloadCount) | 136 .property("downloadCount", &DownloadableSubscription::GetDownloadCount,
&DownloadableSubscription::SetDownloadCount); |
138 .function("serialize", &DownloadableSubscription::Serialize); | |
139 | 137 |
140 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) | 138 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) |
141 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) | 139 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) |
142 .function("subscriptionAt", &FilterStorage::SubscriptionAt) | 140 .function("subscriptionAt", &FilterStorage::SubscriptionAt) |
143 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) | 141 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) |
144 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor
Filter) | 142 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor
Filter) |
145 .function("addSubscription", &FilterStorage::AddSubscription) | 143 .function("addSubscription", &FilterStorage::AddSubscription) |
146 .function("removeSubscription", &FilterStorage::RemoveSubscription) | 144 .function("removeSubscription", &FilterStorage::RemoveSubscription) |
147 .function("moveSubscription", &FilterStorage::MoveSubscription); | 145 .function("moveSubscription", &FilterStorage::MoveSubscription); |
148 | 146 |
(...skipping 14 matching lines...) Expand all Loading... |
163 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount) | 161 .property("filterCount", &ElemHideEmulation_FilterList::GetFilterCount) |
164 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt); | 162 .function("filterAt", &ElemHideEmulation_FilterList::FilterAt); |
165 | 163 |
166 class_<ElemHideEmulation>("ElemHideEmulation") | 164 class_<ElemHideEmulation>("ElemHideEmulation") |
167 .class_function("create", &ElemHideEmulation::Create) | 165 .class_function("create", &ElemHideEmulation::Create) |
168 .function("add", &ElemHideEmulation::Add) | 166 .function("add", &ElemHideEmulation::Add) |
169 .function("remove", &ElemHideEmulation::Remove) | 167 .function("remove", &ElemHideEmulation::Remove) |
170 .function("clear", &ElemHideEmulation::Clear) | 168 .function("clear", &ElemHideEmulation::Clear) |
171 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain); | 169 .function("getRulesForDomain", &ElemHideEmulation::GetRulesForDomain); |
172 | 170 |
| 171 class_<Parser>("_FilterStorage_Parser") |
| 172 .property("subscriptionCount", &Parser::GetSubscriptionCount) |
| 173 .function("process", &Parser::Process) |
| 174 .function("finalize", &Parser::Finalize) |
| 175 .function("subscriptionAt", &Parser::SubscriptionAt) |
| 176 .class_function("create", &Parser::Create); |
| 177 |
| 178 class_<Serializer>("_FilterStorage_Serializer") |
| 179 .property("data", &Serializer::GetData) |
| 180 .function("serialize", &Serializer::Serialize) |
| 181 .class_function("create", &Serializer::Create); |
| 182 |
173 printBindings(); | 183 printBindings(); |
174 RegExpFilter::GenerateCustomBindings(); | 184 RegExpFilter::GenerateCustomBindings(); |
175 FilterNotifier::GenerateCustomBindings::Generate(); | 185 FilterNotifier::GenerateCustomBindings::Generate(); |
176 | 186 |
177 return 0; | 187 return 0; |
178 } | 188 } |
179 catch (const std::exception& e) | 189 catch (const std::exception& e) |
180 { | 190 { |
181 EM_ASM_ARGS( | 191 EM_ASM_ARGS( |
182 console.error("Error occurred generating JavaScript bindings: " + | 192 console.error("Error occurred generating JavaScript bindings: " + |
183 Module.AsciiToString($0)), e.what() | 193 Module.AsciiToString($0)), e.what() |
184 ); | 194 ); |
185 return 1; | 195 return 1; |
186 } | 196 } |
187 } | 197 } |
OLD | NEW |