void FileQueue::matchDir(const DirectoryListing::Directory* dir, QueueItem::StringItemList& ql, const QueueItem::StringMultiMap& qsm) { for(auto& d: dir->directories) { if(!d->getAdls()) matchDir(d, ql, qsm); } for(auto& f: dir->files) { auto s = qsm.equal_range(f->getName()); for_each(s, [f, &ql](const pair<string, QueueItemPtr> tqp) { if (tqp.second->getSize() == f->getSize() && !tqp.second->isFinished() && boost::find_if(ql, CompareSecond<string, QueueItemPtr>(tqp.second)) == ql.end()) ql.emplace_back(f->getPath(), tqp.second); }); } }
void FileQueue::matchDir(const DirectoryListing::Directory::Ptr& dir, QueueItem::StringItemList& ql) const noexcept{ for(const auto& d: dir->directories) { if(!d->getAdls()) matchDir(d, ql); } for(const auto& f: dir->files) { auto tp = tthIndex.equal_range(const_cast<TTHValue*>(&f->getTTH())); for_each(tp, [f, &ql](const pair<TTHValue*, QueueItemPtr>& tqp) { if (!tqp.second->isFinished() && tqp.second->getSize() == f->getSize() && find_if(ql, CompareSecond<string, QueueItemPtr>(tqp.second)) == ql.end()) ql.emplace_back(Util::emptyString, tqp.second); }); } }
void FileQueue::matchDir(const DirectoryListing::Directory* dir, QueueItem::StringItemList& ql) { for(auto& d: dir->directories) { if(!d->getAdls()) matchDir(d, ql); } for(auto& f: dir->files) { auto tp = tthIndex.equal_range(const_cast<TTHValue*>(&f->getTTH())); for(auto& q: tp | map_values) { if (!q->isFinished() && q->getSize() == f->getSize() && find_if(ql, CompareSecond<string, QueueItemPtr>(q)) == ql.end()) ql.emplace_back(Util::emptyString, q); } } }