本文整理汇总了C++中AString::CatPath方法的典型用法代码示例。如果您正苦于以下问题:C++ AString::CatPath方法的具体用法?C++ AString::CatPath怎么用?C++ AString::CatPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AString
的用法示例。
在下文中一共展示了AString::CatPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetFileData
static bool SetFileData(const AString& path, const struct dirent& finddata, FILE_INFO *file)
{
struct stat statdata;
bool success = false;
file->FileName = path.CatPath(finddata.d_name);
file->ShortName = file->FileName.FilePart();
file->Attrib = 0;
if (stat(file->FileName, &statdata) == 0) {
file->FileSize = statdata.st_size;
file->CreateTime.fromtime(statdata.st_mtime);
file->AccessTime.fromtime(statdata.st_atime);
file->WriteTime.fromtime(statdata.st_mtime);
if (statdata.st_mode & S_IRUSR) file->Attrib |= FILE_FLAG_READABLE;
if (statdata.st_mode & S_IWUSR) file->Attrib |= FILE_FLAG_WRITABLE;
if (statdata.st_mode & S_IXUSR) file->Attrib |= FILE_FLAG_EXECUTABLE;
if (statdata.st_mode & S_IRGRP) file->Attrib |= FILE_FLAG_READABLE << 3;
if (statdata.st_mode & S_IWGRP) file->Attrib |= FILE_FLAG_WRITABLE << 3;
if (statdata.st_mode & S_IXGRP) file->Attrib |= FILE_FLAG_EXECUTABLE << 3;
if (statdata.st_mode & S_IROTH) file->Attrib |= FILE_FLAG_READABLE << 6;
if (statdata.st_mode & S_IWOTH) file->Attrib |= FILE_FLAG_WRITABLE << 6;
if (statdata.st_mode & S_IXOTH) file->Attrib |= FILE_FLAG_EXECUTABLE << 6;
if (S_ISDIR(statdata.st_mode)) file->Attrib |= FILE_FLAG_IS_DIR;
success = true;
}
return success;
}
示例2: CollectFiles
bool CollectFiles(const AString& Path, const AString& Pattern, uint_t nSubdirs, AList& list, uint16_t attribMask, uint16_t attribCmp, AQuitHandler *pQuitHandler)
{
COLLECT_CONTEXT context;
context.Pattern = ParsePathRegex(Pattern);
context.pList = &list;
context.pQuitHandler = pQuitHandler;
context.AttribMask = attribMask;
context.AttribCompare = attribCmp;
context.bAnyName = IsRegexAnyPattern(context.Pattern);
return ::Recurse(Path.CatPath("*"), nSubdirs, &__CollectFiles, &context);
}
示例3: CollectFilesEx
bool CollectFilesEx(const AString& Path, const AString& Pattern, uint_t nSubdirs, AList& list, uint_t sortFlags, uint16_t attribSet, uint16_t attribClr, AQuitHandler *pQuitHandler)
{
COLLECTEX_CONTEXT context;
context.Pattern = ParsePathRegex(Pattern);
context.pList = &list;
context.pQuitHandler = pQuitHandler;
context.AttribSet = attribSet;
context.AttribClr = attribClr;
context.bAnyName = IsRegexAnyPattern(context.Pattern);
context.CmpFunc = AFileNode::GetSortFunction(sortFlags);
context.CmpFlags = sortFlags;
return ::Recurse(Path.CatPath("*"), nSubdirs, &__CollectFilesEx, &context);
}
示例4: Recurse
bool Recurse(const AString& Path, const AString& Pattern, uint_t nSubDirs, bool (*fn)(const FILE_INFO *file, void *Context), void *Context)
{
WIN32_FIND_DATA finddata;
AString pattern, pattern1 = ParsePathRegex(Pattern);
FILE_INFO file;
HANDLE handle;
bool ok = true, any = IsRegexAnyPattern(pattern1);
pattern = Path.CatPath("*");
if ((handle = ::FindFirstFile(pattern, &finddata)) != INVALID_HANDLE_VALUE) {
do {
SetFileData(Path, finddata, &file);
if ((file.ShortName != ".") && (file.ShortName != "..")) {
bool done = false;
if (any || MatchPathRegex(file.ShortName, pattern1)) {
ok = (*fn)(&file, Context);
if (!ok) break;
done = true;
}
if ((nSubDirs > 0) && (file.Attrib & FILE_FLAG_IS_DIR)) {
if (!done) {
ok = (*fn)(&file, Context);
if (!ok) break;
}
ok = Recurse(file.FileName, Pattern, nSubDirs - 1, fn, Context);
if (!ok) break;
}
}
} while (ok && ::FindNextFile(handle, &finddata));
::FindClose(handle);
}
return ok;
}
示例5: CatPath
AString CatPath(const AString& dir1, const AString& dir2)
{
if (dir2[0] != '/') return dir1.CatPath(dir2);
return dir2;
}