Logo Search packages:      
Sourcecode: scummvm version File versions

int Common::FSDirectory::listMatchingMembers ( ArchiveMemberList list,
const String pattern 
) [virtual]

Returns a list of matching file names. Pattern can use GLOB wildcards.

Reimplemented from Common::Archive.

Definition at line 264 of file archive.cpp.

References Common::HashMap< Key, Val, HashFunc, EqualFunc >::begin(), Common::String::c_str(), Common::HashMap< Key, Val, HashFunc, EqualFunc >::end(), Common::FSNode::isDirectory(), Common::List< t_T >::push_back(), and Common::String::toLowercase().

Referenced by DefaultSaveFileManager::listSavefiles().

                                                                                   {
      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 (matchPath(it->_key.c_str(), lowercasePattern.c_str())) {
                  list.push_back(ArchiveMemberPtr(new FSNode(it->_value)));
                  matches++;
            }
      }
      return matches;
}


Generated by  Doxygen 1.6.0   Back to index