File indexing completed on 2025-01-05 04:26:48

0001 /*
0002  * Replacement fot QT Bindings that were removed from QT5
0003  * Copyright (C) 2020  Pedro de Carvalho Gomes <pedrogomes81@gmail.com>
0004  *
0005  * This program is free software: you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation, either version 3 of the License, or
0008  * (at your option) any later version.
0009  *
0010  * This program is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017  */
0018 
0019 #ifndef COREFILEINFO_H
0020 #define COREFILEINFO_H
0021 
0022 #include "QtBinding.h"
0023 
0024 #include <QObject>
0025 #include <QFileInfo>
0026 
0027 namespace QtBindings
0028 {
0029     namespace Core
0030     {
0031         class FileInfo : public QObject, public QFileInfo, public QtBindings::Base<FileInfo>
0032         {
0033         Q_OBJECT
0034         public:
0035             Q_INVOKABLE FileInfo();
0036             Q_INVOKABLE FileInfo(const QString &file);
0037             Q_INVOKABLE FileInfo(const QFile &file);
0038             Q_INVOKABLE FileInfo(const QDir &dir, const QString &file);
0039             Q_INVOKABLE FileInfo(const QFileInfo &fileinfo);
0040             Q_INVOKABLE FileInfo(const FileInfo &fileInfo);
0041             Q_INVOKABLE FileInfo(QFileInfoPrivate *d);
0042             Q_INVOKABLE static bool exists(const QString &file);
0043             FileInfo &operator=(const FileInfo &other);
0044         public slots:
0045             QDir absoluteDir() const;
0046             QString absoluteFilePath() const;
0047             QString absolutePath() const;
0048             QString baseName() const;
0049             QString bundleName() const;
0050             bool caching() const;
0051             QString canonicalFilePath() const;
0052             QString canonicalPath() const;
0053             QString completeBaseName() const;
0054             QString completeSuffix() const;
0055             QDateTime birthTime() const;
0056             QDateTime metadataChangeTime() const;
0057             QDir dir() const;
0058             bool exists() const;
0059             QString fileName() const;
0060             QString filePath() const;
0061             QString group() const;
0062             uint groupId() const;
0063             bool isAbsolute() const;
0064             bool isBundle() const;
0065             bool isDir() const;
0066             bool isExecutable() const;
0067             bool isFile() const;
0068             bool isHidden() const;
0069             bool isNativePath() const;
0070             bool isReadable() const;
0071             bool isRelative() const;
0072             bool isRoot() const;
0073             bool isSymLink() const;
0074             bool isWritable() const;
0075             QDateTime lastModified() const;
0076             QDateTime lastRead() const;
0077             bool makeAbsolute();
0078             QString owner() const;
0079             uint ownerId() const;
0080             QString path() const;
0081             bool permission(QFile::Permissions permissions) const;
0082             QFile::Permissions permissions() const;
0083             void refresh();
0084             void setCaching(bool on);
0085             void setFile(const QDir &dir, const QString &file);
0086             void setFile(const QFile &file);
0087             void setFile(const QString &file);
0088             qint64 size() const;
0089             QString suffix() const;
0090             void swap(QFileInfo &other);
0091             QString symLinkTarget() const;
0092         };
0093     }
0094 }
0095 Q_DECLARE_METATYPE(QtBindings::Core::FileInfo)
0096 #endif //COREFILEINFO_H