本文整理汇总了C++中CTFileName::Matches方法的典型用法代码示例。如果您正苦于以下问题:C++ CTFileName::Matches方法的具体用法?C++ CTFileName::Matches怎么用?C++ CTFileName::Matches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTFileName
的用法示例。
在下文中一共展示了CTFileName::Matches方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FillDirList_internal
void FillDirList_internal(const CTFileName &fnmBasePath,
CDynamicStackArray<CTFileName> &afnm, const CTFileName &fnmDir, const CTString &strPattern, BOOL bRecursive,
CDynamicStackArray<CTFileName> *pafnmInclude, CDynamicStackArray<CTFileName> *pafnmExclude)
{
// add the directory to list of directories to search
CListHead lhDirs;
CDirToRead *pdrFirst = new CDirToRead;
pdrFirst->dr_strDir = fnmDir;
lhDirs.AddTail(pdrFirst->dr_lnNode);
// while the list of directories is not empty
while (!lhDirs.IsEmpty()) {
// take the first one
CDirToRead *pdr = LIST_HEAD(lhDirs, CDirToRead, dr_lnNode);
CTFileName fnmDir = pdr->dr_strDir;
delete pdr;
// if the dir is not allowed
if (pafnmInclude!=NULL &&
(!FileMatchesList(*pafnmInclude, fnmDir) || FileMatchesList(*pafnmExclude, fnmDir)) ) {
// skip it
continue;
}
// start listing the directory
struct _finddata_t c_file; long hFile;
hFile = _findfirst( (const char *)(fnmBasePath+fnmDir+"*"), &c_file );
// for each file in the directory
for (
BOOL bFileExists = hFile!=-1;
bFileExists;
bFileExists = _findnext( hFile, &c_file )==0) {
// if dummy dir (this dir, parent dir, or any dir starting with '.')
if (c_file.name[0]=='.') {
// skip it
continue;
}
// get the file's filepath
CTFileName fnm = fnmDir+c_file.name;
// if it is a directory
if (c_file.attrib&_A_SUBDIR) {
// if recursive reading
if (bRecursive) {
// add it to the list of directories to search
CDirToRead *pdrNew = new CDirToRead;
pdrNew->dr_strDir = fnm+"\\";
lhDirs.AddTail(pdrNew->dr_lnNode);
}
// if it matches the pattern
} else if (strPattern=="" || fnm.Matches(strPattern)) {
// add that file
afnm.Push() = fnm;
}
}
}
}
示例2: FileMatchesList
extern BOOL FileMatchesList(CDynamicStackArray<CTFileName> &afnm, const CTFileName &fnm)
{
for(INDEX i=0; i<afnm.Count(); i++) {
if (fnm.Matches(afnm[i]) || fnm.HasPrefix(afnm[i])) {
return TRUE;
}
}
return FALSE;
}