本文整理汇总了C++中QFileSystemMetaData::clearFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileSystemMetaData::clearFlags方法的具体用法?C++ QFileSystemMetaData::clearFlags怎么用?C++ QFileSystemMetaData::clearFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QFileSystemMetaData
的用法示例。
在下文中一共展示了QFileSystemMetaData::clearFlags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openModeToFopenMode
/*!
\internal
Returns the stdlib open string corresponding to a QIODevice::OpenMode.
*/
static inline QByteArray openModeToFopenMode(QIODevice::OpenMode flags, const QFileSystemEntry &fileEntry,
QFileSystemMetaData &metaData)
{
QByteArray mode;
if ((flags & QIODevice::ReadOnly) && !(flags & QIODevice::Truncate)) {
mode = "rb";
if (flags & QIODevice::WriteOnly) {
metaData.clearFlags(QFileSystemMetaData::FileType);
if (!fileEntry.isEmpty()
&& QFileSystemEngine::fillMetaData(fileEntry, metaData, QFileSystemMetaData::FileType)
&& metaData.isFile()) {
mode += '+';
} else {
mode = "wb+";
}
}
} else if (flags & QIODevice::WriteOnly) {
mode = "wb";
if (flags & QIODevice::ReadOnly)
mode += '+';
}
if (flags & QIODevice::Append) {
mode = "ab";
if (flags & QIODevice::ReadOnly)
mode += '+';
}
#if defined(__GLIBC__) && (__GLIBC__ * 0x100 + __GLIBC_MINOR__) >= 0x0207
// must be glibc >= 2.7
mode += 'e';
#endif
return mode;
}
示例2: fillMetaData
//.........这里部分代码省略.........
bool entryExists = true; // innocent until proven otherwise
QT_STATBUF statBuffer;
bool statBufferValid = false;
if (what & QFileSystemMetaData::LinkType) {
if (QT_LSTAT(nativeFilePath, &statBuffer) == 0) {
if (S_ISLNK(statBuffer.st_mode)) {
data.entryFlags |= QFileSystemMetaData::LinkType;
} else {
statBufferValid = true;
data.entryFlags &= ~QFileSystemMetaData::PosixStatFlags;
}
} else {
entryExists = false;
}
data.knownFlagsMask |= QFileSystemMetaData::LinkType;
}
if (statBufferValid || (what & QFileSystemMetaData::PosixStatFlags)) {
if (entryExists && !statBufferValid)
statBufferValid = (QT_STAT(nativeFilePath, &statBuffer) == 0);
if (statBufferValid)
data.fillFromStatBuf(statBuffer);
else {
entryExists = false;
data.creationTime_ = 0;
data.modificationTime_ = 0;
data.accessTime_ = 0;
data.size_ = 0;
data.userId_ = (uint) -2;
data.groupId_ = (uint) -2;
}
// reset the mask
data.knownFlagsMask |= QFileSystemMetaData::PosixStatFlags
| QFileSystemMetaData::ExistsAttribute;
}
#if defined(Q_OS_MACX)
if (what & QFileSystemMetaData::AliasType)
{
if (entryExists) {
FSRef fref;
if (FSPathMakeRef((const UInt8 *)nativeFilePath, &fref, NULL) == noErr) {
Boolean isAlias, isFolder;
if (FSIsAliasFile(&fref, &isAlias, &isFolder) == noErr) {
if (isAlias)
data.entryFlags |= QFileSystemMetaData::AliasType;
}
}
}
data.knownFlagsMask |= QFileSystemMetaData::AliasType;
}
#endif
if (what & QFileSystemMetaData::UserPermissions) {
// calculate user permissions
if (entryExists) {
if (what & QFileSystemMetaData::UserReadPermission) {
if (QT_ACCESS(nativeFilePath, R_OK) == 0)
data.entryFlags |= QFileSystemMetaData::UserReadPermission;
}
if (what & QFileSystemMetaData::UserWritePermission) {
if (QT_ACCESS(nativeFilePath, W_OK) == 0)
data.entryFlags |= QFileSystemMetaData::UserWritePermission;
}
if (what & QFileSystemMetaData::UserExecutePermission) {
if (QT_ACCESS(nativeFilePath, X_OK) == 0)
data.entryFlags |= QFileSystemMetaData::UserExecutePermission;
}
}
data.knownFlagsMask |= (what & QFileSystemMetaData::UserPermissions);
}
if (what & QFileSystemMetaData::HiddenAttribute
&& !data.isHidden()) {
QString fileName = entry.fileName();
if ((fileName.size() > 0 && fileName.at(0) == QLatin1Char('.'))
|| (entryExists && _q_isMacHidden(nativeFilePath)))
data.entryFlags |= QFileSystemMetaData::HiddenAttribute;
data.knownFlagsMask |= QFileSystemMetaData::HiddenAttribute;
}
#if defined(Q_OS_MACX)
if (what & QFileSystemMetaData::BundleType) {
if (entryExists && isPackage(data, entry))
data.entryFlags |= QFileSystemMetaData::BundleType;
data.knownFlagsMask |= QFileSystemMetaData::BundleType;
}
#endif
if (!entryExists) {
data.clearFlags(what);
return false;
}
return data.hasFlags(what);
}