File indexing completed on 2025-01-19 04:22:44
0001 /* 0002 SPDX-FileCopyrightText: 2021 Hamed Masafi <hamed.masfi@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "libkommit_export.h" 0010 #include <QString> 0011 0012 namespace Git 0013 { 0014 0015 class Manager; 0016 class LIBKOMMIT_EXPORT File 0017 { 0018 public: 0019 enum StorageType { InValid, Git, Local }; 0020 File(); 0021 explicit File(QString filePath); 0022 File(Manager *git, QString place, QString filePath); 0023 File(const File &other); 0024 // File(File &&other); 0025 0026 File &operator=(const File &other); 0027 0028 bool save(const QString &path) const; 0029 Q_REQUIRED_RESULT QString saveAsTemp() const; 0030 0031 Q_REQUIRED_RESULT QString content() const; 0032 Q_REQUIRED_RESULT const QString &place() const; 0033 void setPlace(const QString &newPlace); 0034 Q_REQUIRED_RESULT const QString &fileName() const; 0035 void setFileName(const QString &newFileName); 0036 Manager *git() const; 0037 void setGit(Manager *newGit); 0038 0039 Q_REQUIRED_RESULT QString displayName() const; 0040 Q_REQUIRED_RESULT StorageType storage() const; 0041 0042 private: 0043 QString mPlace; 0044 QString mFilePath; 0045 Manager *mGit = nullptr; 0046 0047 StorageType mStorage; 0048 }; 0049 0050 } // namespace Git