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

Side by Side Diff: compiled/bindings.cpp

Issue 29384812: Issue 4127 - [emscripten] Convert subscription classes to C++ - Part 1 (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Replace subscriptionClasses.js properly instead of creating a new file Created March 27, 2017, 9:06 a.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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include "bindings.ipp" 18 #include "bindings.ipp"
19 #include "filter/Filter.h" 19 #include "filter/Filter.h"
20 #include "filter/InvalidFilter.h" 20 #include "filter/InvalidFilter.h"
21 #include "filter/CommentFilter.h" 21 #include "filter/CommentFilter.h"
22 #include "filter/ActiveFilter.h" 22 #include "filter/ActiveFilter.h"
23 #include "filter/RegExpFilter.h" 23 #include "filter/RegExpFilter.h"
24 #include "filter/BlockingFilter.h" 24 #include "filter/BlockingFilter.h"
25 #include "filter/WhitelistFilter.h" 25 #include "filter/WhitelistFilter.h"
26 #include "filter/ElemHideBase.h" 26 #include "filter/ElemHideBase.h"
27 #include "filter/ElemHideFilter.h" 27 #include "filter/ElemHideFilter.h"
28 #include "filter/ElemHideException.h" 28 #include "filter/ElemHideException.h"
29 #include "filter/ElemHideEmulationFilter.h" 29 #include "filter/ElemHideEmulationFilter.h"
30 #include "subscription/Subscription.h"
31 #include "subscription/DownloadableSubscription.h"
32 #include "subscription/UserDefinedSubscription.h"
30 33
31 EMSCRIPTEN_BINDINGS 34 EMSCRIPTEN_BINDINGS
32 { 35 {
33 class_<Filter>("Filter") 36 class_<Filter>("Filter")
34 .property("text", &Filter::GetText) 37 .property("text", &Filter::GetText)
35 .function("serialize", &Filter::Serialize) 38 .function("serialize", &Filter::Serialize)
36 .class_function("fromText", &Filter::FromText) 39 .class_function("fromText", &Filter::FromText)
37 .subclass_differentiator(&Filter::mType, { 40 .subclass_differentiator(&Filter::mType, {
38 {Filter::Type::INVALID, "InvalidFilter"}, 41 {Filter::Type::INVALID, "InvalidFilter"},
39 {Filter::Type::COMMENT, "CommentFilter"}, 42 {Filter::Type::COMMENT, "CommentFilter"},
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 .property("selectorDomain", &ElemHideBase::GetSelectorDomain); 78 .property("selectorDomain", &ElemHideBase::GetSelectorDomain);
76 79
77 class_<ElemHideFilter,ElemHideBase>("ElemHideFilter") 80 class_<ElemHideFilter,ElemHideBase>("ElemHideFilter")
78 .class_property("type", "'elemhide'"); 81 .class_property("type", "'elemhide'");
79 82
80 class_<ElemHideException,ElemHideBase>("ElemHideException") 83 class_<ElemHideException,ElemHideBase>("ElemHideException")
81 .class_property("type", "'elemhideexception'"); 84 .class_property("type", "'elemhideexception'");
82 85
83 class_<ElemHideEmulationFilter,ElemHideBase>("ElemHideEmulationFilter") 86 class_<ElemHideEmulationFilter,ElemHideBase>("ElemHideEmulationFilter")
84 .class_property("type", "'elemhideemulation'"); 87 .class_property("type", "'elemhideemulation'");
88
89 class_<Subscription>("Subscription")
90 .property("url", &Subscription::GetID)
91 .property("title", &Subscription::GetTitle, &Subscription::SetTitle)
92 .property("disabled", &Subscription::GetDisabled, &Subscription::SetDisabl ed)
93 .function("serialize", &Subscription::Serialize)
94 .function("serializeFilters", &Subscription::SerializeFilters)
95 .class_function("fromURL", &Subscription::FromID)
96 .subclass_differentiator(&Subscription::mType, {
97 {Subscription::Type::USERDEFINED, "SpecialSubscription"},
98 {Subscription::Type::DOWNLOADABLE, "DownloadableSubscription"},
99 });
100
101 class_<UserDefinedSubscription,Subscription>("SpecialSubscription")
102 .function("isDefaultFor", &UserDefinedSubscription::IsDefaultFor)
103 .function("makeDefaultFor", &UserDefinedSubscription::MakeDefaultFor)
104 .function("serialize", &UserDefinedSubscription::Serialize);
105
106 class_<DownloadableSubscription,Subscription>("DownloadableSubscription")
107 .property("fixedTitle", &DownloadableSubscription::GetFixedTitle, &Downloa dableSubscription::SetFixedTitle)
108 .property("homepage", &DownloadableSubscription::GetHomepage, &Downloadabl eSubscription::SetHomepage)
109 .property("lastCheck", &DownloadableSubscription::GetLastCheck, &Downloada bleSubscription::SetLastCheck)
110 .property("expires", &DownloadableSubscription::GetHardExpiration, &Downlo adableSubscription::SetHardExpiration)
111 .property("softExpiration", &DownloadableSubscription::GetSoftExpiration, &DownloadableSubscription::SetSoftExpiration)
112 .property("lastDownload", &DownloadableSubscription::GetLastDownload, &Dow nloadableSubscription::SetLastDownload)
113 .property("downloadStatus", &DownloadableSubscription::GetDownloadStatus, &DownloadableSubscription::SetDownloadStatus)
114 .property("lastSuccess", &DownloadableSubscription::GetLastSuccess, &Downl oadableSubscription::SetLastSuccess)
115 .property("errors", &DownloadableSubscription::GetErrorCount, &Downloadabl eSubscription::SetErrorCount)
116 .property("version", &DownloadableSubscription::GetDataRevision, &Download ableSubscription::SetDataRevision)
117 .property("requiredVersion", &DownloadableSubscription::GetRequiredVersion , &DownloadableSubscription::SetRequiredVersion)
118 .property("downloadCount", &DownloadableSubscription::GetDownloadCount, &D ownloadableSubscription::SetDownloadCount)
119 .function("serialize", &DownloadableSubscription::Serialize);
85 } 120 }
OLDNEW

Powered by Google App Engine
This is Rietveld