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

Side by Side Diff: compiled/bindings/main.cpp

Issue 29581602: Issue 5141 - [emscripten] Convert filter matcher to C++ Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Created Oct. 17, 2017, 12:31 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 16 matching lines...) Expand all
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 "../matcher/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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 134
134 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance) 135 singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance)
135 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount) 136 .property("subscriptionCount", &FilterStorage::GetSubscriptionCount)
136 .function("subscriptionAt", &FilterStorage::SubscriptionAt) 137 .function("subscriptionAt", &FilterStorage::SubscriptionAt)
137 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription) 138 .function("indexOfSubscription", &FilterStorage::IndexOfSubscription)
138 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter) 139 .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionFor Filter)
139 .function("addSubscription", &FilterStorage::AddSubscription) 140 .function("addSubscription", &FilterStorage::AddSubscription)
140 .function("removeSubscription", &FilterStorage::RemoveSubscription) 141 .function("removeSubscription", &FilterStorage::RemoveSubscription)
141 .function("moveSubscription", &FilterStorage::MoveSubscription); 142 .function("moveSubscription", &FilterStorage::MoveSubscription);
142 143
144 class_<Matcher>("Matcher")
145 .function("add", &Matcher::Add)
146 .function("remove", &Matcher::Remove)
147 .function("matchesAny", &Matcher::MatchesAny)
148 .class_function("create", &Matcher::Create);
149
143 printBindings(); 150 printBindings();
144 RegExpFilter::GenerateCustomBindings(); 151 RegExpFilter::GenerateCustomBindings();
145 FilterNotifier::GenerateCustomBindings(); 152 FilterNotifier::GenerateCustomBindings();
146 153
147 return 0; 154 return 0;
148 } 155 }
149 catch (const std::exception& e) 156 catch (const std::exception& e)
150 { 157 {
151 EM_ASM_ARGS( 158 EM_ASM_ARGS(
152 console.error("Error occurred generating JavaScript bindings: " + 159 console.error("Error occurred generating JavaScript bindings: " +
153 Module.AsciiToString($0)), e.what() 160 Module.AsciiToString($0)), e.what()
154 ); 161 );
155 return 1; 162 return 1;
156 } 163 }
157 } 164 }
OLDNEW
« no previous file with comments | « compiled/Map.h ('k') | compiled/filter/RegExpFilter.h » ('j') | compiled/filter/RegExpFilter.h » ('J')

Powered by Google App Engine
This is Rietveld