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

Unified Diff: compiled/bindings/main.cpp

Issue 29426559: Issue 5137 - [emscripten] Added basic filter storage implementation (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Fixed bogus assert Created Aug. 31, 2017, 12:44 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/bindings/generator.cpp ('k') | compiled/library.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/bindings/main.cpp
===================================================================
--- a/compiled/bindings/main.cpp
+++ b/compiled/bindings/main.cpp
@@ -28,16 +28,17 @@
#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"
+#include "../storage/FilterStorage.h"
#include "../FilterNotifier.h"
int main()
{
try
{
class_<Filter>("Filter")
.property("text", &Filter::GetText)
@@ -90,30 +91,32 @@ int main()
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)
+ .property("listed", &Subscription::GetListed)
.property("filterCount", &Subscription::GetFilterCount)
.function("filterAt", &Subscription::FilterAt)
.function("indexOfFilter", &Subscription::IndexOfFilter)
.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("isGeneric", &UserDefinedSubscription::IsGeneric)
.function("insertFilterAt", &UserDefinedSubscription::InsertFilterAt)
.function("removeFilterAt", &UserDefinedSubscription::RemoveFilterAt)
.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)
@@ -123,16 +126,25 @@ int main()
.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);
+ singleton<FilterStorage>("FilterStorage", &FilterStorage::GetInstance)
+ .property("subscriptionCount", &FilterStorage::GetSubscriptionCount)
+ .function("subscriptionAt", &FilterStorage::SubscriptionAt)
+ .function("indexOfSubscription", &FilterStorage::IndexOfSubscription)
+ .function("getSubscriptionForFilter", &FilterStorage::GetSubscriptionForFilter)
+ .function("addSubscription", &FilterStorage::AddSubscription)
+ .function("removeSubscription", &FilterStorage::RemoveSubscription)
+ .function("moveSubscription", &FilterStorage::MoveSubscription);
+
printBindings();
RegExpFilter::GenerateCustomBindings();
FilterNotifier::GenerateCustomBindings();
return 0;
}
catch (const std::exception& e)
{
« no previous file with comments | « compiled/bindings/generator.cpp ('k') | compiled/library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld