File indexing completed on 2025-01-05 03:59:36
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2007 Tobias Koenig <tokoe@kde.org> 0004 // 0005 0006 #ifndef MARBLE_FILESTORAGEPOLICY_H 0007 #define MARBLE_FILESTORAGEPOLICY_H 0008 0009 #include "StoragePolicy.h" 0010 0011 namespace Marble 0012 { 0013 0014 class FileStoragePolicy : public StoragePolicy 0015 { 0016 Q_OBJECT 0017 0018 public: 0019 /** 0020 * Creates a new file storage policy. 0021 * 0022 * @param dataDirectory The directory where the data should go to. 0023 * @param parent The parent object. 0024 */ 0025 explicit FileStoragePolicy( const QString &dataDirectory = QString(), QObject *parent = nullptr ); 0026 0027 /** 0028 * Destroys the cache storage policy. 0029 */ 0030 ~FileStoragePolicy() override; 0031 0032 /** 0033 * Returns whether the @p fileName exists already. 0034 */ 0035 bool fileExists( const QString &fileName ) const override; 0036 0037 /** 0038 * Updates the @p fileName with the given @p data. 0039 */ 0040 bool updateFile( const QString &fileName, const QByteArray &data ) override; 0041 0042 /** 0043 * Clears the cache. 0044 */ 0045 void clearCache() override; 0046 0047 /** 0048 * Returns the last error message. 0049 */ 0050 QString lastErrorMessage() const override; 0051 0052 private: 0053 Q_DISABLE_COPY( FileStoragePolicy ) 0054 0055 QString m_dataDirectory; 0056 QString m_errorMsg; 0057 }; 0058 0059 } 0060 0061 #endif