OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |