KoDirectoryStore.h 1.94 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/* This file is part of the KDE project
   Copyright (C) 2002 David Faure <faure@kde.org>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
*/

#ifndef koDirectoryStore_h
#define koDirectoryStore_h

23
#include "KoStore.h"
24 25 26

class QFile;

27
class KoDirectoryStore : public KoStore
28 29
{
public:
30
    KoDirectoryStore(const QString& path, Mode _mode, bool writeMimetype);
31
    ~KoDirectoryStore() override;
32
protected:
33
    void init();
34
    bool openWrite(const QString &name) override {
35 36
        return openReadOrWrite(name, QIODevice::WriteOnly);
    }
37
    bool openRead(const QString &name) override {
38 39
        return openReadOrWrite(name, QIODevice::ReadOnly);
    }
40
    bool closeRead() override {
41 42
        return true;
    }
43
    bool closeWrite() override {
44 45
        return true;
    }
46 47 48
    bool enterRelativeDirectory(const QString &dirName) override;
    bool enterAbsoluteDirectory(const QString &path) override;
    bool fileExists(const QString &absPath) const override;
49

Thomas Zander's avatar
Thomas Zander committed
50
    bool openReadOrWrite(const QString &name, QIODevice::OpenModeFlag ioMode);
51 52 53 54 55 56 57 58 59
private:
    // Path to base directory (== the ctor argument)
    QString m_basePath;

    // Path to current directory
    QString m_currentPath;

    // Current File
    QFile* m_file;
60
    Q_DECLARE_PRIVATE(KoStore)
61 62 63
};

#endif