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

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

Issue 10171027: Compile subscriptions.xml into the libadblockplus build and make itusable (Closed)
Patch Set: Created April 19, 2013, 7:59 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
OLDNEW
1 #include <iostream> 1 #include <iostream>
2 #include <sstream> 2 #include <sstream>
3 3
4 #include "SubscriptionsCommand.h" 4 #include "SubscriptionsCommand.h"
5 5
6 namespace 6 namespace
7 { 7 {
8 typedef std::vector<AdblockPlus::SubscriptionPtr> SubscriptionList; 8 typedef std::vector<AdblockPlus::SubscriptionPtr> SubscriptionList;
9 9
10 void ShowSubscriptionList(const SubscriptionList& subscriptions) 10 void ShowSubscriptionList(const SubscriptionList& subscriptions)
11 { 11 {
12 for (SubscriptionList::const_iterator it = subscriptions.begin(); 12 for (SubscriptionList::const_iterator it = subscriptions.begin();
13 it != subscriptions.end(); it++) 13 it != subscriptions.end(); it++)
14 std::cout << (*it)->GetProperty("title", "(no title)") << " - " << (*it)-> GetProperty("url", "") << std::endl; 14 {
15 std::cout << (*it)->GetProperty("title", "(no title)") << " - " << (*it)-> GetProperty("url", "");
16 if ((*it)->GetProperty("author", "") != "")
17 std::cout << " - " << (*it)->GetProperty("author", "");
18 if ((*it)->GetProperty("specialization", "") != "")
19 std::cout << " - " << (*it)->GetProperty("specialization", "");
20 std::cout << std::endl;
21 }
15 } 22 }
16 } 23 }
17 24
18 SubscriptionsCommand::SubscriptionsCommand( 25 SubscriptionsCommand::SubscriptionsCommand(
19 AdblockPlus::FilterEngine& filterEngine) 26 AdblockPlus::FilterEngine& filterEngine)
20 : Command("subscriptions"), filterEngine(filterEngine) 27 : Command("subscriptions"), filterEngine(filterEngine)
21 { 28 {
22 } 29 }
23 30
24 void SubscriptionsCommand::operator()(const std::string& arguments) 31 void SubscriptionsCommand::operator()(const std::string& arguments)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 void SubscriptionsCommand::UpdateSubscriptions() 105 void SubscriptionsCommand::UpdateSubscriptions()
99 { 106 {
100 const SubscriptionList& subscriptions = filterEngine.GetListedSubscriptions(); 107 const SubscriptionList& subscriptions = filterEngine.GetListedSubscriptions();
101 for (SubscriptionList::const_iterator it = subscriptions.begin(); 108 for (SubscriptionList::const_iterator it = subscriptions.begin();
102 it != subscriptions.end(); it++) 109 it != subscriptions.end(); it++)
103 (*it)->UpdateFilters(); 110 (*it)->UpdateFilters();
104 } 111 }
105 112
106 void SubscriptionsCommand::FetchSubscriptions() 113 void SubscriptionsCommand::FetchSubscriptions()
107 { 114 {
108 filterEngine.FetchAvailableSubscriptions(&ShowSubscriptionList); 115 ShowSubscriptionList(filterEngine.FetchAvailableSubscriptions());
109 } 116 }
OLDNEW

Powered by Google App Engine
This is Rietveld