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

Unified Diff: shell/src/FiltersCommand.cpp

Issue 10100009: FilterEngine API improvements (Closed)
Patch Set: Addressed review comments Created April 8, 2013, 1:51 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
Index: shell/src/FiltersCommand.cpp
===================================================================
--- a/shell/src/FiltersCommand.cpp
+++ b/shell/src/FiltersCommand.cpp
@@ -1,30 +1,54 @@
#include <iostream>
#include <sstream>
#include "FiltersCommand.h"
namespace
{
- typedef std::vector<AdblockPlus::Filter*> FilterList;
+ typedef std::vector<AdblockPlus::FilterPtr> FilterList;
void ShowFilterList(const FilterList& filters)
{
for (FilterList::const_iterator it = filters.begin();
it != filters.end(); it++)
{
+ std::string type;
+ switch ((*it)->GetProperty("type", -1))
+ {
+ case AdblockPlus::BLOCKING_RULE:
+ type = "blocking";
+ break;
+ case AdblockPlus::EXCEPTION_RULE:
+ type = "exception";
+ break;
+ case AdblockPlus::ELEMHIDE_RULE:
+ type = "elemhide";
+ break;
+ case AdblockPlus::ELEMHIDE_EXCEPTION_RULE:
+ type = "elemhideexception";
+ break;
+ case AdblockPlus::COMMENT_RULE:
+ type = "comment";
+ break;
+ case AdblockPlus::INVALID_RULE:
+ type = "invalid";
+ break;
+ default:
+ type = "(unknown type)";
+ break;
+ }
std::cout << (*it)->GetProperty("text", "(no text)") << " - " <<
- (*it)->GetProperty("type", "(no type)") << std::endl;
+ type << std::endl;
}
}
}
-FiltersCommand::FiltersCommand(
- AdblockPlus::FilterEngine& filterEngine)
+FiltersCommand::FiltersCommand(AdblockPlus::FilterEngine& filterEngine)
: Command("filters"), filterEngine(filterEngine)
{
}
void FiltersCommand::operator()(const std::string& arguments)
{
std::istringstream argumentStream(arguments);
std::string action;

Powered by Google App Engine
This is Rietveld