1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef FILEPROPERTY_P_H
5#define FILEPROPERTY_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QFileInfo>
19#include <QDateTime>
20#include <private/qglobal_p.h>
21
22QT_BEGIN_NAMESPACE
23
24class FileProperty
25{
26public:
27 FileProperty(const QFileInfo &info) :
28 mFileName(info.fileName()),
29 mFilePath(info.filePath()),
30 mBaseName(info.baseName()),
31 mSuffix(info.completeSuffix()),
32 mSize(info.size()),
33 mIsDir(info.isDir()),
34 mIsFile(info.isFile()),
35 mLastModified(info.lastModified()),
36 mLastRead(info.lastRead())
37 {
38 }
39 ~FileProperty()
40 {}
41
42 inline QString fileName() const { return mFileName; }
43 inline QString filePath() const { return mFilePath; }
44 inline QString baseName() const { return mBaseName; }
45 inline qint64 size() const { return mSize; }
46 inline QString suffix() const { return mSuffix; }
47 inline bool isDir() const { return mIsDir; }
48 inline bool isFile() const { return mIsFile; }
49 inline QDateTime lastModified() const { return mLastModified; }
50 inline QDateTime lastRead() const { return mLastRead; }
51
52 inline bool operator !=(const FileProperty &fileInfo) const {
53 return !operator==(property: fileInfo);
54 }
55 bool operator ==(const FileProperty &property) const {
56 return ((mFileName == property.mFileName) && (isDir() == property.isDir()));
57 }
58
59private:
60 QString mFileName;
61 QString mFilePath;
62 QString mBaseName;
63 QString mSuffix;
64 qint64 mSize;
65 bool mIsDir;
66 bool mIsFile;
67 QDateTime mLastModified;
68 QDateTime mLastRead;
69};
70
71QT_END_NAMESPACE
72
73#endif // FILEPROPERTY_P_H
74

source code of qtdeclarative/src/labs/folderlistmodel/fileproperty_p.h