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

Unified 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: Addressed comments Created April 13, 2017, 1:02 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « compiled/StringMap.h ('k') | compiled/bindings.ipp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/bindings.cpp
===================================================================
--- a/compiled/bindings.cpp
+++ b/compiled/bindings.cpp
@@ -22,16 +22,19 @@
#include "filter/ActiveFilter.h"
#include "filter/RegExpFilter.h"
#include "filter/BlockingFilter.h"
#include "filter/WhitelistFilter.h"
#include "filter/ElemHideBase.h"
#include "filter/ElemHideFilter.h"
#include "filter/ElemHideException.h"
#include "filter/ElemHideEmulationFilter.h"
+#include "subscription/Subscription.h"
+#include "subscription/DownloadableSubscription.h"
+#include "subscription/UserDefinedSubscription.h"
EMSCRIPTEN_BINDINGS
{
class_<Filter>("Filter")
.property("text", &Filter::GetText)
.function("serialize", &Filter::Serialize)
.class_function("fromText", &Filter::FromText)
.subclass_differentiator(&Filter::mType, {
@@ -77,9 +80,41 @@ EMSCRIPTEN_BINDINGS
class_<ElemHideFilter,ElemHideBase>("ElemHideFilter")
.class_property("type", "'elemhide'");
class_<ElemHideException,ElemHideBase>("ElemHideException")
.class_property("type", "'elemhideexception'");
class_<ElemHideEmulationFilter,ElemHideBase>("ElemHideEmulationFilter")
.class_property("type", "'elemhideemulation'");
+
+ class_<Subscription>("Subscription")
+ .property("url", &Subscription::GetID)
+ .property("title", &Subscription::GetTitle, &Subscription::SetTitle)
+ .property("disabled", &Subscription::GetDisabled, &Subscription::SetDisabled)
+ .function("serialize", &Subscription::Serialize)
+ .function("serializeFilters", &Subscription::SerializeFilters)
+ .class_function("fromURL", &Subscription::FromID)
+ .subclass_differentiator(&Subscription::mType, {
+ {Subscription::Type::USERDEFINED, "SpecialSubscription"},
+ {Subscription::Type::DOWNLOADABLE, "DownloadableSubscription"},
+ });
+
+ class_<UserDefinedSubscription,Subscription>("SpecialSubscription")
+ .function("isDefaultFor", &UserDefinedSubscription::IsDefaultFor)
+ .function("makeDefaultFor", &UserDefinedSubscription::MakeDefaultFor)
+ .function("serialize", &UserDefinedSubscription::Serialize);
+
+ class_<DownloadableSubscription,Subscription>("DownloadableSubscription")
+ .property("fixedTitle", &DownloadableSubscription::GetFixedTitle, &DownloadableSubscription::SetFixedTitle)
+ .property("homepage", &DownloadableSubscription::GetHomepage, &DownloadableSubscription::SetHomepage)
+ .property("lastCheck", &DownloadableSubscription::GetLastCheck, &DownloadableSubscription::SetLastCheck)
+ .property("expires", &DownloadableSubscription::GetHardExpiration, &DownloadableSubscription::SetHardExpiration)
+ .property("softExpiration", &DownloadableSubscription::GetSoftExpiration, &DownloadableSubscription::SetSoftExpiration)
+ .property("lastDownload", &DownloadableSubscription::GetLastDownload, &DownloadableSubscription::SetLastDownload)
+ .property("downloadStatus", &DownloadableSubscription::GetDownloadStatus, &DownloadableSubscription::SetDownloadStatus)
+ .property("lastSuccess", &DownloadableSubscription::GetLastSuccess, &DownloadableSubscription::SetLastSuccess)
+ .property("errors", &DownloadableSubscription::GetErrorCount, &DownloadableSubscription::SetErrorCount)
+ .property("version", &DownloadableSubscription::GetDataRevision, &DownloadableSubscription::SetDataRevision)
+ .property("requiredVersion", &DownloadableSubscription::GetRequiredVersion, &DownloadableSubscription::SetRequiredVersion)
+ .property("downloadCount", &DownloadableSubscription::GetDownloadCount, &DownloadableSubscription::SetDownloadCount)
+ .function("serialize", &DownloadableSubscription::Serialize);
}
« no previous file with comments | « compiled/StringMap.h ('k') | compiled/bindings.ipp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld