Пример #1
0
void ADLSearchManager::matchRecurse(DestDirList &aDestList, DirectoryListing::Directory* aDir, string &aPath) {
	for(DirectoryListing::Directory::Iter dirIt = aDir->directories.begin(); dirIt != aDir->directories.end(); ++dirIt) {
		string tmpPath = aPath + "\\" + (*dirIt)->getName();
		matchesDirectory(aDestList, *dirIt, tmpPath);
		matchRecurse(aDestList, *dirIt, tmpPath);
	}
	for(DirectoryListing::File::Iter fileIt = aDir->files.begin(); fileIt != aDir->files.end(); ++fileIt) {
		matchesFile(aDestList, *fileIt, aPath);
	}
	stepUpDirectory(aDestList);
}
Пример #2
0
void ADLSearchManager::matchRecurse(DestDirList &aDestList, DirectoryListing::Directory* aDir, string &aPath) {
    for(auto& dirIt: aDir->directories) {
        string tmpPath = aPath + "\\" + dirIt->getName();
        matchesDirectory(aDestList, dirIt, tmpPath);
        matchRecurse(aDestList, dirIt, tmpPath);
    }

    for(auto& fileIt: aDir->files) {
        matchesFile(aDestList, fileIt, aPath);
    }

    stepUpDirectory(aDestList);
}
Пример #3
0
void ADLSearchManager::matchesDirectory(DestDirList& destDirVector, DirectoryListing::Directory* currentDir, const string& fullPath) const
{
	// Add to any substructure being stored
	for (auto id = destDirVector.begin(); id != destDirVector.end(); ++id)
	{
		if (id->subdir != NULL)
		{
			DirectoryListing::Directory* newDir =
			    new DirectoryListing::AdlDirectory(fullPath, id->subdir, currentDir->getName());
			id->subdir->directories.push_back(newDir);
			id->subdir = newDir;
		}
	}
	
	// Prepare to match searches
	if (currentDir->getName().size() < 1)
	{
		return;
	}
	
	// Match searches
	for (auto is = collection.cbegin(); is != collection.cend(); ++is)
	{
		if (destDirVector[is->ddIndex].subdir != NULL)
		{
			continue;
		}
		if (is->matchesDirectory(currentDir->getName()))
		{
			destDirVector[is->ddIndex].subdir =
			    new DirectoryListing::AdlDirectory(fullPath, destDirVector[is->ddIndex].dir, currentDir->getName());
			destDirVector[is->ddIndex].dir->directories.push_back(destDirVector[is->ddIndex].subdir);
			if (breakOnFirst)
			{
				// Found a match, search no more
				break;
			}
		}
	}
}