OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 if (!url.size() || !contentTypeStr.size() || !documentUrl.size()) | 46 if (!url.size() || !contentTypeStr.size() || !documentUrl.size()) |
47 { | 47 { |
48 ShowUsage(); | 48 ShowUsage(); |
49 return; | 49 return; |
50 } | 50 } |
51 | 51 |
52 AdblockPlus::FilterPtr match = filterEngine.Matches(url, contentType, document
Url); | 52 AdblockPlus::FilterPtr match = filterEngine.Matches(url, contentType, document
Url); |
53 if (!match) | 53 if (!match) |
54 std::cout << "No match" << std::endl; | 54 std::cout << "No match" << std::endl; |
55 else if (match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION) | 55 else if (match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION) |
56 std::cout << "Whitelisted by " << match->GetProperty("text")->AsString() <<
std::endl; | 56 std::cout << "Whitelisted by " << match->GetProperty("text").AsString() << s
td::endl; |
57 else | 57 else |
58 std::cout << "Blocked by " << match->GetProperty("text")->AsString() << std:
:endl; | 58 std::cout << "Blocked by " << match->GetProperty("text").AsString() << std::
endl; |
59 } | 59 } |
60 | 60 |
61 std::string MatchesCommand::GetDescription() const | 61 std::string MatchesCommand::GetDescription() const |
62 { | 62 { |
63 return "Returns the first filter that matches the supplied URL"; | 63 return "Returns the first filter that matches the supplied URL"; |
64 } | 64 } |
65 | 65 |
66 std::string MatchesCommand::GetUsage() const | 66 std::string MatchesCommand::GetUsage() const |
67 { | 67 { |
68 return name + " URL CONTENT_TYPE DOCUMENT_URL"; | 68 return name + " URL CONTENT_TYPE DOCUMENT_URL"; |
69 } | 69 } |
OLD | NEW |