summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemmetadata_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qfilesystemmetadata_p.h')
-rw-r--r--src/corelib/io/qfilesystemmetadata_p.h95
1 files changed, 40 insertions, 55 deletions
diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h
index 6340e204db..c10b66afaf 100644
--- a/src/corelib/io/qfilesystemmetadata_p.h
+++ b/src/corelib/io/qfilesystemmetadata_p.h
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtCore module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QFILESYSTEMMETADATA_P_H
#define QFILESYSTEMMETADATA_P_H
@@ -54,6 +18,7 @@
#include "qplatformdefs.h"
#include <QtCore/qglobal.h>
#include <QtCore/qdatetime.h>
+#include <QtCore/qtimezone.h>
#include <QtCore/private/qabstractfileengine_p.h>
// Platform-specific includes
@@ -221,11 +186,15 @@ public:
QDateTime metadataChangeTime() const;
QDateTime modificationTime() const;
- QDateTime fileTime(QAbstractFileEngine::FileTime time) const;
+ QDateTime fileTime(QFile::FileTime time) const;
uint userId() const;
uint groupId() const;
uint ownerId(QAbstractFileEngine::FileOwner owner) const;
+ bool isReadable() const { return permissions().testAnyFlags(QFile::ReadUser); }
+ bool isWritable() const { return permissions().testAnyFlags(QFile::WriteUser); }
+ bool isExecutable() const { return permissions().testAnyFlags(QFile::ExeUser); }
+
#ifdef Q_OS_UNIX
void fillFromStatxBuf(const struct statx &statBuffer);
void fillFromStatBuf(const QT_STATBUF &statBuffer);
@@ -243,7 +212,7 @@ private:
MetaDataFlags knownFlagsMask;
MetaDataFlags entryFlags;
- qint64 size_;
+ qint64 size_ = 0;
// Platform-specific data goes here:
#if defined(Q_OS_WIN)
@@ -254,13 +223,13 @@ private:
FILETIME lastWriteTime_;
#else
// msec precision
- qint64 accessTime_;
- qint64 birthTime_;
- qint64 metadataChangeTime_;
- qint64 modificationTime_;
+ qint64 accessTime_ = 0;
+ qint64 birthTime_ = 0;
+ qint64 metadataChangeTime_ = 0;
+ qint64 modificationTime_ = 0;
- uint userId_;
- uint groupId_;
+ uint userId_ = (uint) -2;
+ uint groupId_ = (uint) -2;
#endif
};
@@ -278,19 +247,19 @@ inline bool QFileSystemMetaData::isAlias() const { return fal
#endif
#if defined(Q_OS_UNIX) || defined (Q_OS_WIN)
-inline QDateTime QFileSystemMetaData::fileTime(QAbstractFileEngine::FileTime time) const
+inline QDateTime QFileSystemMetaData::fileTime(QFile::FileTime time) const
{
switch (time) {
- case QAbstractFileEngine::ModificationTime:
+ case QFile::FileModificationTime:
return modificationTime();
- case QAbstractFileEngine::AccessTime:
+ case QFile::FileAccessTime:
return accessTime();
- case QAbstractFileEngine::BirthTime:
+ case QFile::FileBirthTime:
return birthTime();
- case QAbstractFileEngine::MetadataChangeTime:
+ case QFile::FileMetadataChangeTime:
return metadataChangeTime();
}
@@ -300,13 +269,29 @@ inline QDateTime QFileSystemMetaData::fileTime(QAbstractFileEngine::FileTime tim
#if defined(Q_OS_UNIX)
inline QDateTime QFileSystemMetaData::birthTime() const
-{ return birthTime_ ? QDateTime::fromMSecsSinceEpoch(birthTime_, Qt::UTC) : QDateTime(); }
+{
+ return birthTime_
+ ? QDateTime::fromMSecsSinceEpoch(birthTime_, QTimeZone::UTC)
+ : QDateTime();
+}
inline QDateTime QFileSystemMetaData::metadataChangeTime() const
-{ return metadataChangeTime_ ? QDateTime::fromMSecsSinceEpoch(metadataChangeTime_, Qt::UTC) : QDateTime(); }
+{
+ return metadataChangeTime_
+ ? QDateTime::fromMSecsSinceEpoch(metadataChangeTime_, QTimeZone::UTC)
+ : QDateTime();
+}
inline QDateTime QFileSystemMetaData::modificationTime() const
-{ return modificationTime_ ? QDateTime::fromMSecsSinceEpoch(modificationTime_, Qt::UTC) : QDateTime(); }
+{
+ return modificationTime_
+ ? QDateTime::fromMSecsSinceEpoch(modificationTime_, QTimeZone::UTC)
+ : QDateTime();
+}
inline QDateTime QFileSystemMetaData::accessTime() const
-{ return accessTime_ ? QDateTime::fromMSecsSinceEpoch(accessTime_, Qt::UTC) : QDateTime(); }
+{
+ return accessTime_
+ ? QDateTime::fromMSecsSinceEpoch(accessTime_, QTimeZone::UTC)
+ : QDateTime();
+}
inline uint QFileSystemMetaData::userId() const { return userId_; }
inline uint QFileSystemMetaData::groupId() const { return groupId_; }