Marble

CacheStoragePolicy.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2007 Tobias Koenig <tokoe@kde.org>
4//
5
6#ifndef MARBLE_CACHESTORAGEPOLICY_H
7#define MARBLE_CACHESTORAGEPOLICY_H
8
9#include "DiscCache.h"
10#include "StoragePolicy.h"
11
12#include <QString>
13
14#include "marble_export.h"
15
16class QByteArray;
17
18namespace Marble
19{
20
21class MARBLE_EXPORT CacheStoragePolicy : public StoragePolicy
22{
23 Q_OBJECT
24
25 public:
26 /**
27 * Creates a new cache storage policy.
28 *
29 * @param cacheDirectory The directory which shall be used for the cache.
30 */
31 explicit CacheStoragePolicy( const QString &cacheDirectory );
32
33 /**
34 * Destroys the cache storage policy.
35 */
36 ~CacheStoragePolicy() override;
37
38 /**
39 * Returns whether the @p fileName exists already.
40 */
41 bool fileExists( const QString &fileName ) const override;
42
43 /**
44 * Updates the @p fileName with the given @p data.
45 */
46 bool updateFile( const QString &fileName, const QByteArray &data ) override;
47
48 /**
49 * Clears the cache.
50 */
51 void clearCache() override;
52
53 /**
54 * Returns the last error message.
55 */
56 QString lastErrorMessage() const override;
57
58 /**
59 * Returns the data of a file.
60 */
61 QByteArray data( const QString &fileName );
62
63 /**
64 * Sets the limit of the cache in @p bytes.
65 */
66 void setCacheLimit( quint64 bytes );
67
68 /**
69 * Returns the limit of the cache in bytes.
70 */
71 quint64 cacheLimit() const;
72
73 private:
74 DiscCache m_cache;
75 QString m_errorMsg;
76};
77
78}
79
80#endif
bool fileExists(const QUrl &path)
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 21 2024 12:00:06 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.