Left: | ||
Right: |
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 16 matching lines...) Expand all Loading... | |
27 #include "../filter/BlockingFilter.h" | 27 #include "../filter/BlockingFilter.h" |
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 "../filter/Matcher.h" | |
37 #include "../FilterNotifier.h" | 38 #include "../FilterNotifier.h" |
38 | 39 |
39 int main() | 40 int main() |
40 { | 41 { |
41 try | 42 try |
42 { | 43 { |
43 class_<Filter>("Filter") | 44 class_<Filter>("Filter") |
44 .property("text", &Filter::GetText) | 45 .property("text", &Filter::GetText) |
45 .function("serialize", &Filter::Serialize) | 46 .function("serialize", &Filter::Serialize) |
46 .class_function("fromText", &Filter::FromText) | 47 .class_function("fromText", &Filter::FromText) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 .property("softExpiration", &DownloadableSubscription::GetSoftExpiration , &DownloadableSubscription::SetSoftExpiration) | 125 .property("softExpiration", &DownloadableSubscription::GetSoftExpiration , &DownloadableSubscription::SetSoftExpiration) |
125 .property("lastDownload", &DownloadableSubscription::GetLastDownload, &D ownloadableSubscription::SetLastDownload) | 126 .property("lastDownload", &DownloadableSubscription::GetLastDownload, &D ownloadableSubscription::SetLastDownload) |
126 .property("downloadStatus", &DownloadableSubscription::GetDownloadStatus , &DownloadableSubscription::SetDownloadStatus) | 127 .property("downloadStatus", &DownloadableSubscription::GetDownloadStatus , &DownloadableSubscription::SetDownloadStatus) |
127 .property("lastSuccess", &DownloadableSubscription::GetLastSuccess, &Dow nloadableSubscription::SetLastSuccess) | 128 .property("lastSuccess", &DownloadableSubscription::GetLastSuccess, &Dow nloadableSubscription::SetLastSuccess) |
128 .property("errors", &DownloadableSubscription::GetErrorCount, &Downloada bleSubscription::SetErrorCount) | 129 .property("errors", &DownloadableSubscription::GetErrorCount, &Downloada bleSubscription::SetErrorCount) |
129 .property("version", &DownloadableSubscription::GetDataRevision, &Downlo adableSubscription::SetDataRevision) | 130 .property("version", &DownloadableSubscription::GetDataRevision, &Downlo adableSubscription::SetDataRevision) |
130 .property("requiredVersion", &DownloadableSubscription::GetRequiredVersi on, &DownloadableSubscription::SetRequiredVersion) | 131 .property("requiredVersion", &DownloadableSubscription::GetRequiredVersi on, &DownloadableSubscription::SetRequiredVersion) |
131 .property("downloadCount", &DownloadableSubscription::GetDownloadCount, &DownloadableSubscription::SetDownloadCount) | 132 .property("downloadCount", &DownloadableSubscription::GetDownloadCount, &DownloadableSubscription::SetDownloadCount) |
132 .function("serialize", &DownloadableSubscription::Serialize); | 133 .function("serialize", &DownloadableSubscription::Serialize); |
133 | 134 |
135 class_<ReMatchResults>("ReMatchResults") | |
136 .function("push", &ReMatchResults::push); | |
Wladimir Palant
2017/10/09 08:39:47
Why do we need to export what is clearly an intern
sergei
2017/10/09 15:27:51
This class is used as a callback to obtain the res
hub
2017/10/10 13:46:15
The sole purpose of this class is to be able to ge
| |
137 | |
138 class_<CombinedMatcher>("CombinedMatcher") | |
139 .class_function("create", &CombinedMatcher::Create) | |
140 .function("add", &CombinedMatcher::Add) | |
141 .function("remove", &CombinedMatcher::Remove) | |
142 .function("matchesAny", &CombinedMatcher::MatchesAny) | |
143 .function("clear", &CombinedMatcher::Clear) | |
144 .function("hasFilter", &CombinedMatcher::HasFilter) | |
145 .function("getKeywordForFilter", &CombinedMatcher::GetKeywordForFilter) | |
146 .function("findKeyword", &CombinedMatcher::FindKeyword); | |
Wladimir Palant
2017/10/09 08:39:47
The three methods above shouldn't be exported, the
sergei
2017/10/09 15:27:52
I think they are currently exported for the sake o
Wladimir Palant
2017/10/10 07:39:05
Yes, that's probably it. We should remove/rewrite
hub
2017/10/10 13:46:15
Note that currently these are test that exist in m
| |
147 | |
148 class_<Matcher>("Matcher") | |
149 .class_function("create", &Matcher::Create) | |
150 .function("add", &Matcher::Add) | |
151 .function("remove", &Matcher::Remove) | |
152 .function("matchesAny", &Matcher::MatchesAny) | |
153 .function("clear", &Matcher::Clear) | |
154 .function("hasFilter", &Matcher::HasFilter) | |
155 .function("getKeywordForFilter", &Matcher::GetKeywordForFilter) | |
156 .function("findKeyword", &Matcher::FindKeyword); | |
157 | |
134 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) | 158 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) |
135 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) | 159 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) |
136 .function("subscriptionAt", &FilterStorage::SubscriptionAt) | 160 .function("subscriptionAt", &FilterStorage::SubscriptionAt) |
137 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) | 161 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) |
138 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter) | 162 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter) |
139 .function("addSubscription", &FilterStorage::AddSubscription) | 163 .function("addSubscription", &FilterStorage::AddSubscription) |
140 .function("removeSubscription", &FilterStorage::RemoveSubscription) | 164 .function("removeSubscription", &FilterStorage::RemoveSubscription) |
141 .function("moveSubscription", &FilterStorage::MoveSubscription); | 165 .function("moveSubscription", &FilterStorage::MoveSubscription); |
142 | 166 |
143 printBindings(); | 167 printBindings(); |
144 RegExpFilter::GenerateCustomBindings(); | 168 RegExpFilter::GenerateCustomBindings(); |
145 FilterNotifier::GenerateCustomBindings(); | 169 FilterNotifier::GenerateCustomBindings(); |
146 | 170 |
147 return 0; | 171 return 0; |
148 } | 172 } |
149 catch (const std::exception& e) | 173 catch (const std::exception& e) |
150 { | 174 { |
151 EM_ASM_ARGS( | 175 EM_ASM_ARGS( |
152 console.error("Error occurred generating JavaScript bindings: " + | 176 console.error("Error occurred generating JavaScript bindings: " + |
153 Module.AsciiToString($0)), e.what() | 177 Module.AsciiToString($0)), e.what() |
154 ); | 178 ); |
155 return 1; | 179 return 1; |
156 } | 180 } |
157 } | 181 } |
OLD | NEW |