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

Unified Diff: shell/src/FiltersCommand.cpp

Issue 29419607: Issue 5163 - Reduce the use of FilterPtr (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created April 21, 2017, 1:04 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/FiltersCommand.cpp
===================================================================
--- a/shell/src/FiltersCommand.cpp
+++ b/shell/src/FiltersCommand.cpp
@@ -17,25 +17,25 @@
#include <iostream>
#include <sstream>
#include "FiltersCommand.h"
namespace
{
- typedef std::vector<AdblockPlus::FilterPtr> FilterList;
+ typedef std::vector<AdblockPlus::Filter> FilterList;
void ShowFilterList(const FilterList& filters)
{
for (FilterList::const_iterator it = filters.begin();
it != filters.end(); it++)
{
std::string type;
- switch ((*it)->GetType())
+ switch (it->GetType())
{
case AdblockPlus::Filter::TYPE_BLOCKING:
type = "blocking";
break;
case AdblockPlus::Filter::TYPE_EXCEPTION:
type = "exception";
break;
case AdblockPlus::Filter::TYPE_ELEMHIDE:
@@ -49,17 +49,17 @@
break;
case AdblockPlus::Filter::TYPE_INVALID:
type = "invalid";
break;
default:
type = "(unknown type)";
break;
}
- std::cout << (*it)->GetProperty("text").AsString() << " - " <<
+ std::cout << it->GetProperty("text").AsString() << " - " <<
type << std::endl;
}
}
}
FiltersCommand::FiltersCommand(AdblockPlus::FilterEngine& filterEngine)
: Command("filters"), filterEngine(filterEngine)
{
@@ -110,22 +110,22 @@
void FiltersCommand::ShowFilters()
{
ShowFilterList(filterEngine.GetListedFilters());
}
void FiltersCommand::AddFilter(const std::string& text)
{
- AdblockPlus::FilterPtr filter = filterEngine.GetFilter(text);
- filter->AddToList();
+ AdblockPlus::Filter filter = filterEngine.GetFilter(text);
+ filter.AddToList();
}
void FiltersCommand::RemoveFilter(const std::string& text)
{
- AdblockPlus::FilterPtr filter = filterEngine.GetFilter(text);
- if (!filter->IsListed())
+ AdblockPlus::Filter filter = filterEngine.GetFilter(text);
+ if (!filter.IsListed())
{
std::cout << "No such filter '" << text << "'" << std::endl;
return;
}
- filter->RemoveFromList();
+ filter.RemoveFromList();
}
« 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