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: Created March 16, 2017, 6:27 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
Index: compiled/subscription/UserDefinedSubscription.cpp
===================================================================
--- a/compiled/subscription/UserDefinedSubscription.cpp
+++ b/compiled/subscription/UserDefinedSubscription.cpp
@@ -21,16 +21,33 @@ bool UserDefinedSubscription::IsDefaultF
return mDefaults & filterTypeToDefaults[filter->mType];
}
void UserDefinedSubscription::MakeDefaultFor(const Filter* filter)
{
mDefaults |= filterTypeToDefaults[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 & Defaults::BLOCKING)
result.append(u" blocking"_str);

Powered by Google App Engine
This is Rietveld