File indexing completed on 2024-04-21 05:42:27
0001 // clang-format off 0002 /* 0003 * KDiff3 - Text Diff And Merge Tool 0004 * 0005 * SPDX-FileCopyrightText: 2018-2021 Michael Reeves reeves.87@gmail.com 0006 * SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 // clang-format on 0009 0010 #ifndef MOCIGNOREFILE_H 0011 #define MOCIGNOREFILE_H 0012 0013 #include "FileAccessJobHandlerMoc.h" 0014 #include "../fileaccess.h" 0015 0016 #include <QString> 0017 0018 #include <list> 0019 0020 //typedef class MocIgnoreFile FileAccess; 0021 //typedef std::list<FileAccess> t_DirectoryList; 0022 0023 class MocIgnoreFile: public FileAccess 0024 { 0025 public: 0026 MocIgnoreFile() 0027 { 0028 mJobHandler.reset(new FileAccessJobHandlerMoc(this)); 0029 /* 0030 FileAccess set file calls our overriden loadData to actually get file meta data. 0031 This way we can avoid making any actual FileSystem checks on the simulated file. 0032 */ 0033 setFile(QUrl("/test/ui/.cvsignore")); 0034 } 0035 void setParent(MocIgnoreFile* parent) { m_pParent = (FileAccess*)parent;} 0036 void setFileName(const QString& name) { m_name = name; } 0037 0038 void loadData() override 0039 { 0040 m_bValidData = true; 0041 m_bExists = true; 0042 m_bReadable = true; 0043 0044 m_name = ".cvsignore"; 0045 setUrl(QUrl("/test/ui/.cvsignore")); 0046 } 0047 void addPath([[maybe_unused]] const QString& txt, bool /*reinit*/ = true) override {} 0048 bool createLocalCopy() override { return true; } 0049 0050 [[nodiscard]] qint64 size() const override { return 0; }; 0051 0052 [[nodiscard]] bool isFile() const override { return true; }; 0053 [[nodiscard]] bool isDir() const override { return false; }; 0054 [[nodiscard]] bool isSymLink() const override { return false; }; 0055 [[nodiscard]] bool exists() const override { return m_bExists; }; 0056 [[nodiscard]] bool isReadable() const override { return m_bReadable; }; 0057 [[nodiscard]] bool isWritable() const override { return m_bWritable; }; 0058 [[nodiscard]] bool isExecutable() const override { return m_bExecutable; }; 0059 [[nodiscard]] bool isHidden() const override { return m_bHidden; }; 0060 0061 bool readFile(void* /*pDestBuffer*/, qint64 /*maxLength*/) override { return true;}; 0062 bool writeFile(const void* /*pSrcBuffer*/, qint64 /*length*/) override { return true; }; 0063 0064 private: 0065 QString mPath = "/test/ui/.cvsignore"; 0066 }; 0067 0068 #endif // !FILEACCESS_H