Logo Search packages:      
Sourcecode: scummvm version File versions  Download package

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

Add all the names present in the Archive which match pattern to list. Returned names can be used as parameters to createReadStreamForMember. Must not remove elements from the list.

Returns:
the number of names added to list

Reimplemented in Common::SearchSet, and Common::FSDirectory.

Definition at line 46 of file archive.cpp.

References Common::List< t_T >::begin(), Common::List< t_T >::end(), listMembers(), Common::List< t_T >::push_back(), and Common::String::toLowercase().

                                                                               {
      // Get all "names" (TODO: "files" ?)
      ArchiveMemberList allNames;
      listMembers(allNames);

      int matches = 0;

      // need to match lowercase key
      String lowercasePattern = pattern;
      lowercasePattern.toLowercase();

      ArchiveMemberList::iterator it = allNames.begin();
      for ( ; it != allNames.end(); ++it) {
            if ((*it)->getName().matchString(lowercasePattern, true)) {
                  list.push_back(*it);
                  matches++;
            }
      }

      return matches;
}


Generated by  Doxygen 1.6.0   Back to index