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

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

Issue 10254076: API cleanup, get rid of JsObject and GetProperty() methods that don`t return JsValue (Closed)
Patch Set: Created April 26, 2013, 11:41 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 | « shell/src/MatchesCommand.cpp ('k') | src/FilterEngine.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 "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 { 14 {
15 std::cout << (*it)->GetProperty("title", "(no title)") << " - " << (*it)-> GetProperty("url", ""); 15 std::cout << (*it)->GetProperty("title")->AsString();
16 if ((*it)->GetProperty("author", "") != "") 16 std::cout << " - " << (*it)->GetProperty("url")->AsString();
17 std::cout << " - " << (*it)->GetProperty("author", ""); 17 if (!(*it)->GetProperty("author")->IsUndefined())
18 if ((*it)->GetProperty("specialization", "") != "") 18 std::cout << " - " << (*it)->GetProperty("author")->AsString();
19 std::cout << " - " << (*it)->GetProperty("specialization", ""); 19 if (!(*it)->GetProperty("specialization")->IsUndefined())
20 std::cout << " - " << (*it)->GetProperty("specialization")->AsString();
20 std::cout << std::endl; 21 std::cout << std::endl;
21 } 22 }
22 } 23 }
23 } 24 }
24 25
25 SubscriptionsCommand::SubscriptionsCommand( 26 SubscriptionsCommand::SubscriptionsCommand(
26 AdblockPlus::FilterEngine& filterEngine) 27 AdblockPlus::FilterEngine& filterEngine)
27 : Command("subscriptions"), filterEngine(filterEngine) 28 : Command("subscriptions"), filterEngine(filterEngine)
28 { 29 {
29 } 30 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 const SubscriptionList& subscriptions = filterEngine.GetListedSubscriptions(); 108 const SubscriptionList& subscriptions = filterEngine.GetListedSubscriptions();
108 for (SubscriptionList::const_iterator it = subscriptions.begin(); 109 for (SubscriptionList::const_iterator it = subscriptions.begin();
109 it != subscriptions.end(); it++) 110 it != subscriptions.end(); it++)
110 (*it)->UpdateFilters(); 111 (*it)->UpdateFilters();
111 } 112 }
112 113
113 void SubscriptionsCommand::FetchSubscriptions() 114 void SubscriptionsCommand::FetchSubscriptions()
114 { 115 {
115 ShowSubscriptionList(filterEngine.FetchAvailableSubscriptions()); 116 ShowSubscriptionList(filterEngine.FetchAvailableSubscriptions());
116 } 117 }
OLDNEW
« no previous file with comments | « shell/src/MatchesCommand.cpp ('k') | src/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld