| OLD | NEW | 
|---|
|  | 1 #include <iostream> | 
|  | 2 #include <sstream> | 
|  | 3 | 
| 1 #include "MatchesCommand.h" | 4 #include "MatchesCommand.h" | 
| 2 | 5 | 
| 3 MatchesCommand::MatchesCommand() : Command("matches") | 6 MatchesCommand::MatchesCommand(AdblockPlus::FilterEngine& filterEngine) | 
|  | 7   : Command("matches"), filterEngine(filterEngine) | 
| 4 { | 8 { | 
| 5 } | 9 } | 
| 6 | 10 | 
| 7 void MatchesCommand::operator()(const std::string& arguments) | 11 void MatchesCommand::operator()(const std::string& arguments) | 
| 8 { | 12 { | 
|  | 13   std::istringstream argumentStream(arguments); | 
|  | 14   std::string url; | 
|  | 15   argumentStream >> url; | 
|  | 16   std::string contentType; | 
|  | 17   argumentStream >> contentType; | 
|  | 18   if (!url.size() || !contentType.size()) | 
|  | 19   { | 
|  | 20     ShowUsage(); | 
|  | 21     return; | 
|  | 22   } | 
|  | 23 | 
|  | 24   if (filterEngine.Matches(url, contentType)) | 
|  | 25     std::cout << "Match" << std::endl; | 
|  | 26   else | 
|  | 27     std::cout << "No match" << std::endl; | 
| 9 } | 28 } | 
| 10 | 29 | 
| 11 std::string MatchesCommand::GetDescription() const | 30 std::string MatchesCommand::GetDescription() const | 
| 12 { | 31 { | 
| 13   return "Returns the first filter that matches the supplied URL"; | 32   return "Returns the first filter that matches the supplied URL"; | 
| 14 } | 33 } | 
| 15 | 34 | 
| 16 std::string MatchesCommand::GetUsage() const | 35 std::string MatchesCommand::GetUsage() const | 
| 17 { | 36 { | 
| 18   return name + " URL"; | 37   return name + " URL CONTENT_TYPE"; | 
| 19 } | 38 } | 
| OLD | NEW | 
|---|