Exemple #1
0
UString FileList::findFirst(const UString &str, bool caseInsensitive) const {
	UString match = caseInsensitive ? str.toLower() : str;

	// Iterate through the whole list, adding the matches to the sub list
	for (Files::const_iterator it = _files.begin(); it != _files.end(); ++it) {
		bool matching = caseInsensitive ? it->toLower().endsWith(match) : it->endsWith(match);

		if (matching)
			return *it;
	}

	return "";
}
Exemple #2
0
bool FileList::getSubList(const UString &str, bool caseInsensitive, FileList &subList) const {
	UString match = caseInsensitive ? str.toLower() : str;

	bool foundMatch = false;

	// Iterate through the whole list, adding the matches to the sub list
	for (Files::const_iterator it = _files.begin(); it != _files.end(); ++it) {
		bool matching = caseInsensitive ? it->toLower().endsWith(match) : it->endsWith(match);

		if (matching) {
			subList._files.push_back(*it);
			foundMatch = true;
		}
	}

	return foundMatch;
}