13
0

Rename PathScanner::run_scan_internal to PathScanner::find_files_matching_filter

This commit is contained in:
Tim Mayberry 2014-06-17 11:32:51 +10:00
parent 3066bd48da
commit cde8776e80
2 changed files with 26 additions and 31 deletions

View File

@ -78,10 +78,10 @@ PathScanner::find_files_matching_regex (vector<string>& result,
return; return;
} }
run_scan_internal (result, dirpath, find_files_matching_filter (result, dirpath,
regexp_filter, &compiled_pattern, regexp_filter, &compiled_pattern,
match_fullpath, return_fullpath, match_fullpath, return_fullpath,
limit, recurse); limit, recurse);
regfree (&compiled_pattern); regfree (&compiled_pattern);
} }
@ -105,13 +105,13 @@ PathScanner::operator() (const string &dirpath, const string &regexp,
} }
void void
PathScanner::run_scan_internal (vector<string>& result, PathScanner::find_files_matching_filter (vector<string>& result,
const string &dirpath, const string &dirpath,
bool (*filter)(const string &, void *), bool (*filter)(const string &, void *),
void *arg, void *arg,
bool match_fullpath, bool return_fullpath, bool match_fullpath, bool return_fullpath,
long limit, long limit,
bool recurse) bool recurse)
{ {
DIR *dir; DIR *dir;
struct dirent *finfo; struct dirent *finfo;
@ -149,7 +149,7 @@ PathScanner::run_scan_internal (vector<string>& result,
} }
if (statbuf.st_mode & S_IFDIR && recurse) { if (statbuf.st_mode & S_IFDIR && recurse) {
run_scan_internal (result, fullpath, filter, arg, match_fullpath, return_fullpath, limit, recurse); find_files_matching_filter (result, fullpath, filter, arg, match_fullpath, return_fullpath, limit, recurse);
} else { } else {
if (match_fullpath) { if (match_fullpath) {
@ -205,14 +205,9 @@ PathScanner::find_first (const string &dirpath,
bool return_fullpath) bool return_fullpath)
{ {
vector<string> res; vector<string> res;
string ret;
run_scan_internal (res, find_files_matching_filter (res, dirpath, filter, 0,
dirpath, match_fullpath, return_fullpath, 1);
filter,
0,
match_fullpath,
return_fullpath, 1);
if (res.size() == 0) { if (res.size() == 0) {
return string(); return string();

View File

@ -42,10 +42,10 @@ class LIBPBD_API PathScanner
long limit = -1, long limit = -1,
bool recurse = false) { bool recurse = false) {
std::vector<std::string> result; std::vector<std::string> result;
run_scan_internal (result, dirpath, find_files_matching_filter (result, dirpath,
filter, arg, filter, arg,
match_fullpath, return_fullpath, match_fullpath, return_fullpath,
limit, recurse); limit, recurse);
return result; return result;
} }
@ -77,14 +77,14 @@ class LIBPBD_API PathScanner
long limit, long limit,
bool recurse = false); bool recurse = false);
void run_scan_internal (std::vector<std::string>&, void find_files_matching_filter (std::vector<std::string>&,
const std::string &dirpath, const std::string &dirpath,
bool (*filter)(const std::string &, void *), bool (*filter)(const std::string &, void *),
void *arg, void *arg,
bool match_fullpath, bool match_fullpath,
bool return_fullpath, bool return_fullpath,
long limit, long limit,
bool recurse = false); bool recurse = false);
}; };
#endif // __libmisc_pathscanner_h__ #endif // __libmisc_pathscanner_h__