bool SearchQuery::matchesFileLower(const string& aName, int64_t aSize, uint64_t aDate) noexcept { if (!matchesDate(aDate) || !matchesSize(aSize)) { return false; } // Validate exact matches first if (matchType == Search::MATCH_NAME_EXACT && compare(include.getPatterns().front().str(), aName) != 0) { return false; } // Matching and positions resetPositions(); lastIncludeMatches = include.matchLower(aName, recursion ? true : false, &lastIncludePositions); dcassert(count(lastIncludePositions.begin(), lastIncludePositions.end(), string::npos) == (int)include.count() - lastIncludeMatches); if (!positionsComplete()) return false; // Check file type... if (!hasExt(aName)) return false; if (isExcludedLower(aName)) return false; return true; }
bool AdcSearch::matchesFileLower(const string& aName, int64_t aSize, uint64_t aDate) { if(!(aSize >= gt)) { return false; } else if(!(aSize <= lt)) { return false; } else if (!(aDate == 0 || (aDate >= minDate && aDate <= maxDate))) { return false; } if (matchType == MATCH_EXACT) { if (compare((*include->begin()).getPattern(), aName) != 0) return false; } else { auto j = include->begin(); for(; j != include->end() && j->matchLower(aName); ++j) ; // Empty if(j != include->end()) return false; } // Check file type... if (!hasExt(aName)) return false; if(isExcluded(aName)) return false; return true; }
bool ApogeeTMB::detect(const QString &filePath, char* /*magic*/) { if(hasExt(filePath, ".tmb")) return true; QFile file(filePath); if(!file.open(QIODevice::ReadOnly)) return false; qint64 fileSize = file.bytesAvailable(); file.close(); return (fileSize == (256 * 13)); }
bool hasExt(const std::string &path, const std::string &ext) { return hasExt(boost::filesystem::path(path), ext); }