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

Side by Side Diff: shell/src/FiltersCommand.cpp

Issue 10236010: Always work with pointers to filters and subscriptions, drop the references for API consistency (Closed)
Patch Set: Created April 11, 2013, 7:24 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/AdblockPlus/FilterEngine.h ('k') | shell/src/SubscriptionsCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include <iostream> 1 #include <iostream>
2 #include <sstream> 2 #include <sstream>
3 3
4 #include "FiltersCommand.h" 4 #include "FiltersCommand.h"
5 5
6 namespace 6 namespace
7 { 7 {
8 typedef std::vector<AdblockPlus::FilterPtr> FilterList; 8 typedef std::vector<AdblockPlus::FilterPtr> FilterList;
9 9
10 void ShowFilterList(const FilterList& filters) 10 void ShowFilterList(const FilterList& filters)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return name + " [add FILTER|remove FILTER]"; 91 return name + " [add FILTER|remove FILTER]";
92 } 92 }
93 93
94 void FiltersCommand::ShowFilters() 94 void FiltersCommand::ShowFilters()
95 { 95 {
96 ShowFilterList(filterEngine.GetListedFilters()); 96 ShowFilterList(filterEngine.GetListedFilters());
97 } 97 }
98 98
99 void FiltersCommand::AddFilter(const std::string& text) 99 void FiltersCommand::AddFilter(const std::string& text)
100 { 100 {
101 AdblockPlus::Filter& filter = filterEngine.GetFilter(text); 101 AdblockPlus::FilterPtr filter = filterEngine.GetFilter(text);
102 filter.AddToList(); 102 filter->AddToList();
103 } 103 }
104 104
105 void FiltersCommand::RemoveFilter(const std::string& text) 105 void FiltersCommand::RemoveFilter(const std::string& text)
106 { 106 {
107 AdblockPlus::Filter& filter = filterEngine.GetFilter(text); 107 AdblockPlus::FilterPtr filter = filterEngine.GetFilter(text);
108 if (!filter.IsListed()) 108 if (!filter->IsListed())
109 { 109 {
110 std::cout << "No such filter '" << text << "'" << std::endl; 110 std::cout << "No such filter '" << text << "'" << std::endl;
111 return; 111 return;
112 } 112 }
113 filter.RemoveFromList(); 113 filter->RemoveFromList();
114 } 114 }
OLDNEW
« no previous file with comments | « include/AdblockPlus/FilterEngine.h ('k') | shell/src/SubscriptionsCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld