File indexing completed on 2024-04-28 15:16:08

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2007 Tobias Koenig <tokoe@kde.org>
0004 // SPDX-FileCopyrightText: 2009 Bastian Holst <bastianholst@gmx.de>
0005 //
0006 
0007 #ifndef MARBLE_STORAGEPOLICY_H
0008 #define MARBLE_STORAGEPOLICY_H
0009 
0010 
0011 #include <QObject>
0012 
0013 class QByteArray;
0014 class QString;
0015 
0016 namespace Marble
0017 {
0018 
0019 class StoragePolicy : public QObject
0020 {
0021     Q_OBJECT
0022     
0023     public:
0024         explicit StoragePolicy( QObject *parent = nullptr );
0025     
0026         ~StoragePolicy() override {}
0027 
0028         virtual bool fileExists( const QString &fileName ) const = 0;
0029 
0030         /**
0031          * Return true if file was written successfully.
0032          */
0033         virtual bool updateFile( const QString &fileName, const QByteArray &data ) = 0;
0034 
0035     virtual void clearCache() = 0;
0036 
0037         virtual QString lastErrorMessage() const = 0;
0038     
0039     Q_SIGNALS:
0040     void cleared();
0041     void sizeChanged( qint64 );
0042     
0043     private:
0044     Q_DISABLE_COPY( StoragePolicy )
0045 };
0046 
0047 }
0048 
0049 #endif