| Index: shell/src/MatchesCommand.cpp |
| =================================================================== |
| --- a/shell/src/MatchesCommand.cpp |
| +++ b/shell/src/MatchesCommand.cpp |
| @@ -1,11 +1,30 @@ |
| +#include <iostream> |
| +#include <sstream> |
| + |
| #include "MatchesCommand.h" |
| -MatchesCommand::MatchesCommand() : Command("matches") |
| +MatchesCommand::MatchesCommand(AdblockPlus::FilterEngine& filterEngine) |
| + : Command("matches"), filterEngine(filterEngine) |
| { |
| } |
| void MatchesCommand::operator()(const std::string& arguments) |
| { |
| + std::istringstream argumentStream(arguments); |
| + std::string url; |
| + argumentStream >> url; |
| + std::string contentType; |
| + argumentStream >> contentType; |
| + if (!url.size() || !contentType.size()) |
| + { |
| + ShowUsage(); |
| + return; |
| + } |
| + |
| + if (filterEngine.Matches(url, contentType)) |
| + std::cout << "Match" << std::endl; |
| + else |
| + std::cout << "No match" << std::endl; |
| } |
| std::string MatchesCommand::GetDescription() const |
| @@ -15,5 +34,5 @@ |
| std::string MatchesCommand::GetUsage() const |
| { |
| - return name + " URL"; |
| + return name + " URL CONTENT_TYPE"; |
| } |