Index: src/FilterEngine.cpp |
=================================================================== |
--- a/src/FilterEngine.cpp |
+++ b/src/FilterEngine.cpp |
@@ -270,21 +270,20 @@ std::string FilterEngine::ContentTypeToS |
return it->second; |
throw std::invalid_argument("Argument is not a valid ContentType"); |
} |
FilterEngine::ContentType FilterEngine::StringToContentType(const std::string& contentType) |
{ |
std::string contentTypeUpper = contentType; |
std::transform(contentType.begin(), contentType.end(), contentTypeUpper.begin(), ::toupper); |
- for (ContentTypeMap::const_iterator it = contentTypes.begin(); |
- it != contentTypes.end(); it++) |
+ for (const auto& contentType : contentTypes) |
{ |
- if (it->second == contentTypeUpper) |
- return it->first; |
+ if (contentType.second == contentTypeUpper) |
+ return contentType.first; |
} |
throw std::invalid_argument("Cannot convert argument to ContentType"); |
} |
bool FilterEngine::IsFirstRun() const |
{ |
return firstRun; |
} |
@@ -373,19 +372,17 @@ AdblockPlus::FilterPtr FilterEngine::Mat |
AdblockPlus::FilterPtr FilterEngine::Matches(const std::string& url, |
ContentTypeMask contentTypeMask, |
const std::vector<std::string>& documentUrls) const |
{ |
if (documentUrls.empty()) |
return CheckFilterMatch(url, contentTypeMask, ""); |
std::string lastDocumentUrl = documentUrls.front(); |
- for (std::vector<std::string>::const_iterator it = documentUrls.begin(); |
- it != documentUrls.end(); it++) { |
- const std::string documentUrl = *it; |
+ for (const auto& documentUrl : documentUrls) { |
AdblockPlus::FilterPtr match = CheckFilterMatch(documentUrl, |
CONTENT_TYPE_DOCUMENT, |
lastDocumentUrl); |
if (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION) |
return match; |
lastDocumentUrl = documentUrl; |
} |
@@ -422,18 +419,18 @@ AdblockPlus::FilterPtr FilterEngine::Che |
std::vector<std::string> FilterEngine::GetElementHidingSelectors(const std::string& domain) const |
{ |
JsValuePtr func = jsEngine->Evaluate("API.getElementHidingSelectors"); |
JsValueList params; |
params.push_back(jsEngine->NewValue(domain)); |
JsValueList result = func->Call(params)->AsList(); |
std::vector<std::string> selectors; |
- for (JsValueList::iterator it = result.begin(); it != result.end(); ++it) |
- selectors.push_back((*it)->AsString()); |
+ for (const auto& r: result) |
+ selectors.push_back(r->AsString()); |
return selectors; |
} |
JsValuePtr FilterEngine::GetPref(const std::string& pref) const |
{ |
JsValuePtr func = jsEngine->Evaluate("API.getPref"); |
JsValueList params; |
params.push_back(jsEngine->NewValue(pref)); |