File indexing completed on 2024-05-12 15:59:59

0001 /* This file is part of the KDE project
0002    SPDX-FileCopyrightText: 2002 David Faure <faure@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef koDirectoryStore_h
0008 #define koDirectoryStore_h
0009 
0010 #include "KoStore.h"
0011 
0012 class QFile;
0013 
0014 class KoDirectoryStore : public KoStore
0015 {
0016 public:
0017     KoDirectoryStore(const QString& path, Mode _mode, bool writeMimetype);
0018     ~KoDirectoryStore() override;
0019 protected:
0020     void init();
0021     bool openWrite(const QString &name) override {
0022         return openReadOrWrite(name, QIODevice::WriteOnly);
0023     }
0024     bool openRead(const QString &name) override {
0025         return openReadOrWrite(name, QIODevice::ReadOnly);
0026     }
0027     bool closeRead() override {
0028         return true;
0029     }
0030     bool closeWrite() override {
0031         return true;
0032     }
0033     bool enterRelativeDirectory(const QString &dirName) override;
0034     bool enterAbsoluteDirectory(const QString &path) override;
0035     bool fileExists(const QString &absPath) const override;
0036 
0037     bool openReadOrWrite(const QString &name, QIODevice::OpenModeFlag ioMode);
0038 private:
0039     // Path to base directory (== the ctor argument)
0040     QString m_basePath;
0041 
0042     // Path to current directory
0043     QString m_currentPath;
0044 
0045     // Current File
0046     QFile* m_file;
0047     Q_DECLARE_PRIVATE(KoStore)
0048 };
0049 
0050 #endif