1 /* 2 * KDiff3 - Text Diff And Merge Tool 3 * 4 * SPDX-FileCopyrightText: 2018-2021 Michael Reeves reeves.87@gmail.com 5 * SPDX-License-Identifier: GPL-2.0-or-later 6 */ 7 8 #ifndef MOCIGNOREFILE_H 9 #define MOCIGNOREFILE_H 10 11 #include "FileAccessJobHandlerMoc.h" 12 #include "../fileaccess.h" 13 14 #include <QString> 15 16 #include <list> 17 18 //typedef class MocIgnoreFile FileAccess; 19 //typedef std::list<FileAccess> t_DirectoryList; 20 21 class MocIgnoreFile: public FileAccess 22 { 23 public: MocIgnoreFile()24 MocIgnoreFile() 25 { 26 //Q_ASSERT(false); 27 mJobHandler.reset(new FileAccessJobHandlerMoc(this)); 28 /* 29 FileAccess set file calls our overriden loadData to actually get file meta data. 30 This way we can avoid making any actual FileSystem checks on the simulated file. 31 */ 32 setFile(QUrl("/test/ui/.cvsignore")); 33 } setParent(MocIgnoreFile * parent)34 void setParent(MocIgnoreFile* parent) { m_pParent = (FileAccess*)parent;} setFileName(const QString & name)35 void setFileName(const QString& name) { m_name = name; } 36 loadData()37 void loadData() override 38 { 39 m_bValidData = true; 40 m_bExists = true; 41 m_bReadable = true; 42 43 m_name = ".cvsignore"; 44 setUrl(QUrl("/test/ui/.cvsignore")); 45 } 46 void addPath(const QString& txt, bool /*reinit*/=true) override { Q_UNUSED(txt); } createLocalCopy()47 bool createLocalCopy() override { return true; } 48 size()49 Q_REQUIRED_RESULT qint64 size() const override { return 0; }; 50 isFile()51 Q_REQUIRED_RESULT bool isFile() const override {return true;}; isDir()52 Q_REQUIRED_RESULT bool isDir() const override {return false;}; isSymLink()53 Q_REQUIRED_RESULT bool isSymLink() const override {return false;}; exists()54 Q_REQUIRED_RESULT bool exists() const override {return m_bExists; }; isReadable()55 Q_REQUIRED_RESULT bool isReadable() const override {return m_bReadable;}; isWritable()56 Q_REQUIRED_RESULT bool isWritable() const override {return m_bWritable;}; isExecutable()57 Q_REQUIRED_RESULT bool isExecutable() const override {return m_bExecutable;}; isHidden()58 Q_REQUIRED_RESULT bool isHidden() const override { return m_bHidden; }; 59 readFile(void *,qint64)60 bool readFile(void* /*pDestBuffer*/, qint64 /*maxLength*/) override { return true;}; writeFile(const void *,qint64)61 bool writeFile(const void* /*pSrcBuffer*/, qint64 /*length*/) override { return true; }; 62 63 private: 64 QString mPath = "/test/ui/.cvsignore"; 65 }; 66 67 #endif // !FILEACCESS_H 68