File indexing completed on 2024-04-21 05:42:43

0001 /*
0002   SPDX-FileCopyrightText: 2002-2007 Joachim Eibl, joachim.eibl at gmx.de
0003   SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com
0004   SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "fileaccess.h"
0008 
0009 #include <QString>
0010 
0011 FileAccess::FileAccess(const QString& name, bool bWantToWrite)
0012 {
0013   assert(!bWantToWrite);
0014 
0015   m_name = name;
0016 }
0017 
0018 //   FileAccess( const QString& name, bool bWantToWrite=false ); // name: local file or dirname or url (when supported)
0019 //   void setFile( const QString& name, bool bWantToWrite=false );
0020 //
0021 bool FileAccess::isValid() const
0022 {
0023   return m_name.length() != 0;
0024 }
0025 
0026 //   bool isFile() const;
0027 //   bool isDir() const;
0028 //   bool isSymLink() const;
0029 bool FileAccess::exists() const
0030 {
0031     return true;
0032 }
0033 qint64 FileAccess::size() const
0034 {
0035     return 64;
0036 }
0037 
0038 qint64 FileAccess::sizeForReading()
0039 {
0040     return 64;
0041 }
0042 
0043 //   bool isReadable() const;
0044 //   bool isWritable() const;
0045 //   bool isExecutable() const;
0046 //   bool isHidden() const;
0047 //   QString readLink() const;
0048 //
0049 //   QDateTime   created()       const;
0050 //   QDateTime   lastModified()  const;
0051 //   QDateTime   lastRead()      const;
0052 //
0053 //   QString fileName() const; // Just the name-part of the path, without parent directories
0054 //   QString filePath() const; // The path-string that was used during construction
0055 QString FileAccess::prettyAbsPath() const
0056 {
0057     return QString("");
0058 }
0059 //   KUrl url() const;
0060 QString FileAccess::absoluteFilePath() const
0061 {
0062   return "";
0063 }
0064 
0065 bool FileAccess::isLocal() const
0066 {
0067   return true;
0068 }
0069 
0070 bool FileAccess::readFile(void* pDestBuffer, qint64 maxLength )
0071 {
0072     Q_UNUSED(pDestBuffer)
0073     Q_UNUSED(maxLength);
0074     return true;
0075 }
0076 bool FileAccess::writeFile(const void* pSrcBuffer, qint64 length )
0077 {
0078     Q_UNUSED(pSrcBuffer);
0079     Q_UNUSED(length);
0080     return true;
0081 }
0082 
0083 //   bool listDir( t_DirectoryList* pDirList, bool bRecursive, bool bFindHidden,
0084 //                 const QString& filePattern, const QString& fileAntiPattern,
0085 //                 const QString& dirAntiPattern, bool bFollowDirLinks, bool bUseCvsIgnore );
0086 bool FileAccess::copyFile( const QString& destUrl )
0087 {
0088     Q_UNUSED(destUrl);
0089     return true;
0090 }
0091 //   bool createBackup( const QString& bakExtension );
0092 //
0093 QString FileAccess::getTempName() const
0094 {
0095     return QString("");
0096 }
0097 
0098 bool FileAccess::removeFile()
0099 {
0100     return true;
0101 }
0102