int CdfArchive::listMembers(ArchiveMemberList &list) const { for(HashMap<String, FileEntry>::const_iterator it = m_FileEntries.begin(); it != m_FileEntries.end(); ++it) list.push_back(ArchiveMemberList::value_type(new GenericArchiveMember(it->_key, this))); return m_FileEntries.size(); }
int ZipArchive::listMembers(ArchiveMemberList &list) const { int members = 0; const unz_s *const archive = (const unz_s *)_zipFile; for (ZipHash::const_iterator i = archive->_hash.begin(), end = archive->_hash.end(); i != end; ++i) { list.push_back(ArchiveMemberList::value_type(new GenericArchiveMember(i->_key, this))); ++members; } return members; }
int FSDirectory::listMembers(ArchiveMemberList &list) const { if (!_node.isDirectory()) return 0; // Cache dir data ensureCached(); int files = 0; for (NodeCache::const_iterator it = _fileCache.begin(); it != _fileCache.end(); ++it) { list.push_back(ArchiveMemberPtr(new FSNode(it->_value))); ++files; } return files; }
int ZipArchive::listMembers(ArchiveMemberList &list) { int matches = 0; int err = unzGoToFirstFile(_zipFile); while (err == UNZ_OK) { char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; if (unzGetCurrentFileInfo(_zipFile, NULL, szCurrentFileName, sizeof(szCurrentFileName)-1, NULL, 0, NULL, 0) == UNZ_OK) { list.push_back(ArchiveMemberList::value_type(new GenericArchiveMember(szCurrentFileName, this))); matches++; } err = unzGoToNextFile(_zipFile); } return matches; }
int Archive::listMatchingMembers(ArchiveMemberList &list, const String &pattern) { // Get all "names" (TODO: "files" ?) ArchiveMemberList allNames; listMembers(allNames); int matches = 0; ArchiveMemberList::iterator it = allNames.begin(); for ( ; it != allNames.end(); ++it) { // TODO: We match case-insenstivie for now, our API does not define whether that's ok or not though... // For our use case case-insensitive is probably what we want to have though. if ((*it)->getName().matchString(pattern, true, true)) { list.push_back(*it); matches++; } } return matches; }
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; }
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; }