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 #include "CoreFile.h" 0020 0021 using namespace QtBindings::Core; 0022 0023 File::File() 0024 { 0025 } 0026 0027 File::File(const File &file) : QFile() 0028 { 0029 *this = file; 0030 } 0031 0032 File::File(const QString &name, QObject *parent) : QFile(name, parent) 0033 { 0034 } 0035 0036 File::File(QObject *parent) : QFile(parent) 0037 { 0038 } 0039 0040 File::File(const QString &name) : QFile(name) 0041 { 0042 } 0043 0044 File::~File() 0045 { 0046 } 0047 0048 void File::close() 0049 { 0050 QFile::close(); 0051 } 0052 0053 bool File::copy(const QString &fileName, const QString &newName) 0054 { 0055 return QFile::copy(fileName,newName); 0056 } 0057 0058 QString File::decodeName(const char *localFileName) 0059 { 0060 return QFile::decodeName(localFileName); 0061 } 0062 0063 QString File::decodeName(const QByteArray &localFileName) 0064 { 0065 return QFile::decodeName(localFileName); 0066 } 0067 0068 QByteArray File::encodeName(const QString &fileName) 0069 { 0070 return QFile::encodeName(fileName); 0071 } 0072 0073 bool File::exists(const QString &fileName) 0074 { 0075 return QFile::exists(fileName); 0076 } 0077 0078 bool File::link(const QString &fileName, const QString &linkName) 0079 { 0080 return QFile::link(fileName,linkName); 0081 } 0082 0083 QFileDevice::Permissions File::permissions(const QString &fileName) 0084 { 0085 return QFile::permissions(fileName); 0086 } 0087 0088 bool File::remove(const QString &fileName) 0089 { 0090 return QFile::remove(fileName); 0091 } 0092 0093 bool File::rename(const QString &oldName, const QString &newName) 0094 { 0095 return QFile::rename(oldName,newName); 0096 } 0097 0098 bool File::resize(const QString &fileName, qint64 sz) 0099 { 0100 return QFile::resize(fileName,sz); 0101 } 0102 0103 bool File::setPermissions(const QString &fileName, 0104 QFileDevice::Permissions permissions) 0105 { 0106 return QFile::setPermissions(fileName,permissions); 0107 } 0108 0109 QString File::symLinkTarget(const QString &fileName) 0110 { 0111 return QFile::symLinkTarget(fileName); 0112 } 0113 0114 bool File::copy(const QString &newName) 0115 { 0116 return QFile::copy(newName); 0117 } 0118 0119 bool File::exists() const 0120 { 0121 return QFile::exists(); 0122 } 0123 0124 QString File::fileName() const 0125 { 0126 return QFile::fileName(); 0127 } 0128 0129 bool File::link(const QString &linkName) 0130 { 0131 return QFile::link(linkName); 0132 } 0133 /* 0134 bool File::open(FILE *fh, QIODevice::OpenMode mode, 0135 QFileDevice::FileHandleFlags handleFlags) 0136 { 0137 return QFile::open(fh, mode, handleFlags); 0138 } 0139 0140 bool File::open(int fd, QIODevice::OpenMode mode, 0141 QFileDevice::FileHandleFlags handleFlags) 0142 { 0143 return QFile::open(fd, mode, handleFlags); 0144 } 0145 0146 bool File::open(QIODevice::OpenMode mode) 0147 { 0148 return QFile::open(mode); 0149 } 0150 */ 0151 0152 bool File::open(QtBindings::Core::IODevice::OpenModeFlag mode) 0153 { 0154 return QFile::open( QIODevice::OpenMode(mode) ); 0155 } 0156 0157 QFileDevice::Permissions File::permissions() const 0158 { 0159 return QFile::permissions(); 0160 } 0161 0162 bool File::remove() 0163 { 0164 return QFile::remove(); 0165 } 0166 0167 bool File::rename(const QString &newName) 0168 { 0169 return QFile::rename(newName); 0170 } 0171 0172 bool File::resize(qint64 sz) 0173 { 0174 return QFile::resize(sz); 0175 } 0176 0177 void File::setFileName(const QString &name) 0178 { 0179 QFile::setFileName(name); 0180 } 0181 0182 bool File::setPermissions(QFileDevice::Permissions permissions) 0183 { 0184 return QFile::setPermissions(permissions); 0185 } 0186 0187 qint64 File::size() const 0188 { 0189 return QFile::size(); 0190 } 0191 0192 QString File::symLinkTarget() const 0193 { 0194 return QFile::symLinkTarget(); 0195 } 0196 0197 File &File::operator=(const File &other) 0198 { 0199 if (this != &other ) { 0200 this->setFileName(other.fileName()); 0201 this->setPermissions(other.permissions()); 0202 this->setCurrentReadChannel(other.currentReadChannel()); 0203 this->setCurrentWriteChannel(other.currentWriteChannel()); 0204 this->setTextModeEnabled(other.isTextModeEnabled()); 0205 this->setErrorString(other.errorString()); 0206 this->setOpenMode(other.openMode()); 0207 } 0208 return *this; 0209 }