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

Unified Diff: shell/src/SubscriptionsCommand.cpp

Issue 29419623: Issue 5165 - Remove SubscriptionPtr (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Make Subscription(JsValue&&) protected Created April 21, 2017, 3:46 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 | « include/AdblockPlus/FilterEngine.h ('k') | src/FilterEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/src/SubscriptionsCommand.cpp
===================================================================
--- a/shell/src/SubscriptionsCommand.cpp
+++ b/shell/src/SubscriptionsCommand.cpp
@@ -17,29 +17,29 @@
#include <iostream>
#include <sstream>
#include "SubscriptionsCommand.h"
namespace
{
- typedef std::vector<AdblockPlus::SubscriptionPtr> SubscriptionList;
+ typedef std::vector<AdblockPlus::Subscription> SubscriptionList;
void ShowSubscriptionList(const SubscriptionList& subscriptions)
{
for (SubscriptionList::const_iterator it = subscriptions.begin();
it != subscriptions.end(); it++)
{
- std::cout << (*it)->GetProperty("title").AsString();
- std::cout << " - " << (*it)->GetProperty("url").AsString();
- if (!(*it)->GetProperty("author").IsUndefined())
- std::cout << " - " << (*it)->GetProperty("author").AsString();
- if (!(*it)->GetProperty("specialization").IsUndefined())
- std::cout << " - " << (*it)->GetProperty("specialization").AsString();
+ std::cout << it->GetProperty("title").AsString();
+ std::cout << " - " << it->GetProperty("url").AsString();
+ if (!it->GetProperty("author").IsUndefined())
+ std::cout << " - " << it->GetProperty("author").AsString();
+ if (!it->GetProperty("specialization").IsUndefined())
+ std::cout << " - " << it->GetProperty("specialization").AsString();
std::cout << std::endl;
}
}
}
SubscriptionsCommand::SubscriptionsCommand(
AdblockPlus::FilterEngine& filterEngine)
: Command("subscriptions"), filterEngine(filterEngine)
@@ -98,37 +98,37 @@
void SubscriptionsCommand::ShowSubscriptions()
{
ShowSubscriptionList(filterEngine.GetListedSubscriptions());
}
void SubscriptionsCommand::AddSubscription(const std::string& url,
const std::string& title)
{
- AdblockPlus::SubscriptionPtr subscription = filterEngine.GetSubscription(url);
+ AdblockPlus::Subscription subscription = filterEngine.GetSubscription(url);
if (title.size())
- subscription->SetProperty("title", title);
- subscription->AddToList();
+ subscription.SetProperty("title", title);
+ subscription.AddToList();
}
void SubscriptionsCommand::RemoveSubscription(const std::string& url)
{
- AdblockPlus::SubscriptionPtr subscription = filterEngine.GetSubscription(url);
- if (!subscription->IsListed())
+ AdblockPlus::Subscription subscription = filterEngine.GetSubscription(url);
+ if (!subscription.IsListed())
{
std::cout << "No subscription with URL '" << url << "'" << std::endl;
return;
}
- subscription->RemoveFromList();
+ subscription.RemoveFromList();
}
void SubscriptionsCommand::UpdateSubscriptions()
{
- const SubscriptionList& subscriptions = filterEngine.GetListedSubscriptions();
- for (SubscriptionList::const_iterator it = subscriptions.begin();
+ SubscriptionList subscriptions = filterEngine.GetListedSubscriptions();
+ for (SubscriptionList::iterator it = subscriptions.begin();
it != subscriptions.end(); it++)
- (*it)->UpdateFilters();
+ it->UpdateFilters();
}
void SubscriptionsCommand::FetchSubscriptions()
{
ShowSubscriptionList(filterEngine.FetchAvailableSubscriptions());
}
« no previous file with comments | « include/AdblockPlus/FilterEngine.h ('k') | src/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld