本文整理汇总了C++中QFileSystemMetaData::fillFromStatBuf方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileSystemMetaData::fillFromStatBuf方法的具体用法?C++ QFileSystemMetaData::fillFromStatBuf怎么用?C++ QFileSystemMetaData::fillFromStatBuf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QFileSystemMetaData
的用法示例。
在下文中一共展示了QFileSystemMetaData::fillFromStatBuf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillMetaData
//static
bool QFileSystemEngine::fillMetaData(int fd, QFileSystemMetaData &data)
{
data.entryFlags &= ~QFileSystemMetaData::PosixStatFlags;
data.knownFlagsMask |= QFileSystemMetaData::PosixStatFlags;
QT_STATBUF statBuffer;
if (QT_FSTAT(fd, &statBuffer) == 0) {
data.fillFromStatBuf(statBuffer);
return true;
}
return false;
}
示例2: fillMetaData
//static
bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemMetaData &data,
QFileSystemMetaData::MetaDataFlags what)
{
#if !defined(QWS) && !defined(Q_WS_QPA) && defined(Q_OS_MAC)
if (what & QFileSystemMetaData::BundleType) {
if (!data.hasFlags(QFileSystemMetaData::DirectoryType))
what |= QFileSystemMetaData::DirectoryType;
}
#endif
#if !defined(QWS) && !defined(Q_WS_QPA) && defined(Q_OS_MAC) \
&& MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if (what & QFileSystemMetaData::HiddenAttribute) {
// Mac OS >= 10.5: st_flags & UF_HIDDEN
what |= QFileSystemMetaData::PosixStatFlags;
}
#endif
if (what & QFileSystemMetaData::PosixStatFlags)
what |= QFileSystemMetaData::PosixStatFlags;
if (what & QFileSystemMetaData::ExistsAttribute) {
// FIXME: Would other queries being performed provide this bit?
what |= QFileSystemMetaData::PosixStatFlags;
}
data.entryFlags &= ~what;
const char * nativeFilePath;
int nativeFilePathLength;
{
const QByteArray &path = entry.nativeFilePath();
nativeFilePath = path.constData();
nativeFilePathLength = path.size();
Q_UNUSED(nativeFilePathLength);
}
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(QWS) && !defined(Q_WS_QPA) && defined(Q_OS_MAC)
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) {
//.........这里部分代码省略.........
示例3: fillMetaData
//static
bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemMetaData &data,
QFileSystemMetaData::MetaDataFlags what)
{
#if defined(Q_OS_MACX)
if (what & QFileSystemMetaData::BundleType) {
if (!data.hasFlags(QFileSystemMetaData::DirectoryType))
what |= QFileSystemMetaData::DirectoryType;
}
if (what & QFileSystemMetaData::HiddenAttribute) {
// Mac OS >= 10.5: st_flags & UF_HIDDEN
what |= QFileSystemMetaData::PosixStatFlags;
}
#endif // defined(Q_OS_MACX)
if (what & QFileSystemMetaData::PosixStatFlags)
what |= QFileSystemMetaData::PosixStatFlags;
if (what & QFileSystemMetaData::ExistsAttribute) {
// FIXME: Would other queries being performed provide this bit?
what |= QFileSystemMetaData::PosixStatFlags;
}
data.entryFlags &= ~what;
const char * nativeFilePath;
int nativeFilePathLength;
{
const QByteArray &path = entry.nativeFilePath();
nativeFilePath = path.constData();
nativeFilePathLength = path.size();
Q_UNUSED(nativeFilePathLength);
}
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) {
//.........这里部分代码省略.........