Example #1
0
int FSDirectory::listMatchingMembers(ArchiveMemberList &list, const String &pattern) {
	if (!_node.isDirectory())
		return 0;

	// Cache dir data
	ensureCached();

	String lowercasePattern(pattern);
	lowercasePattern.toLowercase();

	int matches = 0;
	NodeCache::iterator it = _fileCache.begin();
	for ( ; it != _fileCache.end(); ++it) {
		if (it->_key.matchString(lowercasePattern, true)) {
			list.push_back(ArchiveMemberPtr(new FSNode(it->_value)));
			matches++;
		}
	}
	return matches;
}
Example #2
0
int FSDirectory::listMatchingMembers(ArchiveMemberList &list, const String &pattern) const {
    if (!_node.isDirectory())
        return 0;

    // Cache dir data
    ensureCached();

    // need to match lowercase key, since all entries in our file cache are
    // stored as lowercase.
    String lowercasePattern(pattern);
    lowercasePattern.toLowercase();

    int matches = 0;
    NodeCache::const_iterator it = _fileCache.begin();
    for ( ; it != _fileCache.end(); ++it) {
        if (it->_key.matchString(lowercasePattern, false, true)) {
            list.push_back(ArchiveMemberPtr(new FSNode(it->_value)));
            matches++;
        }
    }
    return matches;
}