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

Unified Diff: compiled/subscription/UserDefinedSubscription.cpp

Issue 29385742: Issue 4127 - [emscripten] Convert subscription classes to C++ - Part 2 (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Rebased Created April 13, 2017, 1:01 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/subscription/UserDefinedSubscription.h ('k') | test/subscriptionClasses.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/subscription/UserDefinedSubscription.cpp
===================================================================
--- a/compiled/subscription/UserDefinedSubscription.cpp
+++ b/compiled/subscription/UserDefinedSubscription.cpp
@@ -65,16 +65,33 @@ void UserDefinedSubscription::MakeDefaul
if (filter->mType >= Filter::Type::VALUE_COUNT)
{
assert(false, "Filter type exceeds valid range");
abort();
}
mDefaults |= filterTypeToCategory[filter->mType];
}
+void UserDefinedSubscription::InsertFilterAt(Filter* filter, unsigned pos)
+{
+ if (pos >= mFilters.size())
+ mFilters.emplace_back(filter);
+ else
+ mFilters.emplace(mFilters.begin() + pos, filter);
+}
+
+bool UserDefinedSubscription::RemoveFilterAt(unsigned pos)
+{
+ if (pos >= mFilters.size())
+ return false;
+
+ mFilters.erase(mFilters.begin() + pos);
+ return true;
+}
+
OwnedString UserDefinedSubscription::Serialize() const
{
OwnedString result(Subscription::Serialize());
if (mDefaults)
{
result.append(u"defaults="_str);
if (mDefaults & FilterCategory::BLOCKING)
result.append(u" blocking"_str);
« no previous file with comments | « compiled/subscription/UserDefinedSubscription.h ('k') | test/subscriptionClasses.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld