[Scummvm-cvs-logs] SF.net SVN: scummvm: [29228] scummvm/trunk
david_corrales at users.sourceforge.net
david_corrales at users.sourceforge.net
Tue Oct 16 22:24:40 CEST 2007
Revision: 29228
http://scummvm.svn.sourceforge.net/scummvm/?rev=29228&view=rev
Author: david_corrales
Date: 2007-10-16 13:24:39 -0700 (Tue, 16 Oct 2007)
Log Message:
-----------
Committing the set of patches #1814434, thanks to jvprat. They improve the documentation and parameter naming of the lookFile methods inside Common::FS.
Modified Paths:
--------------
scummvm/trunk/backends/saves/default/default-saves.cpp
scummvm/trunk/common/fs.cpp
scummvm/trunk/common/fs.h
Modified: scummvm/trunk/backends/saves/default/default-saves.cpp
===================================================================
--- scummvm/trunk/backends/saves/default/default-saves.cpp 2007-10-16 20:03:23 UTC (rev 29227)
+++ scummvm/trunk/backends/saves/default/default-saves.cpp 2007-10-16 20:24:39 UTC (rev 29228)
@@ -119,7 +119,7 @@
Common::StringList results;
Common::String search(regex);
- if (savePath.lookupFile(savefiles, savePath, search, false, true)) {
+ if (savePath.lookupFile(savefiles, search, false, true)) {
for (FSList::const_iterator file = savefiles.begin(); file != savefiles.end(); file++) {
results.push_back(file->getPath());
}
Modified: scummvm/trunk/common/fs.cpp
===================================================================
--- scummvm/trunk/common/fs.cpp 2007-10-16 20:03:23 UTC (rev 29227)
+++ scummvm/trunk/common/fs.cpp 2007-10-16 20:24:39 UTC (rev 29228)
@@ -171,36 +171,38 @@
return _realNode->isWritable();
}
-bool FilesystemNode::lookupFile(FSList &results, FSList &fslist, Common::String &filename, bool hidden, bool exhaustive) const
+bool FilesystemNode::lookupFile(FSList &results, FSList &fslist, Common::String &pattern, bool hidden, bool exhaustive) const
{
int matches = 0;
for (FSList::iterator entry = fslist.begin(); entry != fslist.end(); ++entry) {
if (entry->isDirectory()) {
- matches += lookupFileRec(results, *entry, filename, hidden, exhaustive);
+ matches += lookupFileRec(results, *entry, pattern, hidden, exhaustive);
}
}
return ((matches > 0) ? true : false);
}
-bool FilesystemNode::lookupFile(FSList &results, FilesystemNode &dir, Common::String &filename, bool hidden, bool exhaustive) const
+bool FilesystemNode::lookupFile(FSList &results, Common::String &pattern, bool hidden, bool exhaustive) const
{
int matches;
- if (!dir.isDirectory())
+ if (!isDirectory())
return false;
- matches = lookupFileRec(results, dir, filename, hidden, exhaustive);
+ FilesystemNode dir = *this;
+ matches = lookupFileRec(results, dir, pattern, hidden, exhaustive);
return ((matches > 0) ? true : false);
}
-int FilesystemNode::lookupFileRec(FSList &results, FilesystemNode &dir, Common::String &filename, bool hidden, bool exhaustive) const
+int FilesystemNode::lookupFileRec(FSList &results, FilesystemNode &dir, Common::String &pattern, bool hidden, bool exhaustive) const
{
FSList entries;
FSList children;
int matches = 0;
+ pattern.toUppercase();
dir.getChildren(entries, FilesystemNode::kListAll, hidden);
//Breadth search (entries in the same level)
@@ -208,7 +210,9 @@
if (entry->isDirectory()) {
children.push_back(*entry);
} else {
- if (Common::matchString(entry->getName().c_str(), filename.c_str())) {
+ Common::String filename = entry->getName();
+ filename.toUppercase();
+ if (Common::matchString(filename.c_str(), pattern.c_str())) {
results.push_back(*entry);
matches++;
@@ -220,7 +224,7 @@
//Depth search (entries in lower levels)
for (FSList::iterator child = children.begin(); child != children.end(); ++child) {
- matches += lookupFileRec(results, *child, filename, hidden, exhaustive);
+ matches += lookupFileRec(results, *child, pattern, hidden, exhaustive);
}
return matches;
Modified: scummvm/trunk/common/fs.h
===================================================================
--- scummvm/trunk/common/fs.h 2007-10-16 20:03:23 UTC (rev 29227)
+++ scummvm/trunk/common/fs.h 2007-10-16 20:24:39 UTC (rev 29228)
@@ -225,29 +225,28 @@
*
* @param results List to put the matches in.
* @param fslist List of directories to search within.
- * @param filename Name of the file to look for.
+ * @param pattern Pattern of the files to look for.
* @param hidden Whether to search hidden files or not.
* @param exhaustive Whether to continue searching after one match has been found.
*
* @return true if matches could be found, false otherwise.
*/
- virtual bool lookupFile(FSList &results, FSList &fslist, Common::String &filename, bool hidden, bool exhaustive) const;
+ virtual bool lookupFile(FSList &results, FSList &fslist, Common::String &pattern, bool hidden, bool exhaustive) const;
/**
- * Searches recursively for a filename inside the given directory.
+ * Searches recursively for a filename inside this directory.
*
* The search is performed breadth-first, that is, the current directory entries
* are scanned before going into subdirectories.
*
* @param results List to put the matches in.
- * @param FilesystemNode Directory to search within.
- * @param filename Name of the file to look for.
+ * @param pattern Pattern of the files to look for.
* @param hidden Whether to search hidden files or not.
* @param exhaustive Whether to continue searching after one match has been found.
*
* @return true if matches could be found, false otherwise.
*/
- virtual bool lookupFile(FSList &results, FilesystemNode &dir, Common::String &filename, bool hidden, bool exhaustive) const;
+ virtual bool lookupFile(FSList &results, Common::String &pattern, bool hidden, bool exhaustive) const;
protected:
/**
@@ -263,14 +262,14 @@
* are scanned before going into subdirectories.
*
* @param results List to put the matches in.
- * @param FilesystemNode Directory to search within.
- * @param filename Name of the file to look for.
+ * @param dir Directory to search within.
+ * @param pattern Pattern of the files to look for.
* @param hidden Whether to search hidden files or not.
* @param exhaustive Whether to continue searching after one match has been found.
*
* @return The number of matches found.
*/
- int lookupFileRec(FSList &results, FilesystemNode &dir, Common::String &filename, bool hidden, bool exhaustive) const;
+ int lookupFileRec(FSList &results, FilesystemNode &dir, Common::String &pattern, bool hidden, bool exhaustive) const;
};
//} // End of namespace Common
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list