QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
network
qgsrangerequestcache.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsrangerequestcache.h
3
--------------------
4
begin : April 2022
5
copyright : (C) 2022 by Belgacem Nedjima
6
email : belgacem dot nedjima at gmail dot com
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#ifndef QGSRANGEREQUESTCACHE_H
19
#define QGSRANGEREQUESTCACHE_H
20
21
#include "qgis_core.h"
22
23
#include <QByteArray>
24
#include <QDir>
25
#include <QFileInfoList>
26
#include <QMap>
27
#include <QNetworkRequest>
28
#include <QUrl>
29
#include <QtGlobal>
30
31
#define SIP_NO_FILE
32
42
class
CORE_EXPORT
QgsRangeRequestCache
43
{
44
public
:
45
QgsRangeRequestCache
();
46
48
bool
hasEntry
(
const
QNetworkRequest &request );
50
QByteArray
entry
(
const
QNetworkRequest &request );
52
void
registerEntry
(
const
QNetworkRequest &request, QByteArray data );
53
55
void
clear
();
56
62
bool
setCacheDirectory
(
const
QString &path );
64
void
setCacheSize
( qint64 maxBytes );
65
67
QString
error
()
const
{
return
mError; }
68
69
friend
class
TestQgsCopcProvider
;
70
71
private
:
72
QString mError;
73
QString mCacheDir;
74
qint64 mMaxDataSize = 256 * 1024 * 1024;
75
76
QString rangeFileName(
const
QNetworkRequest &request )
const
;
77
78
QByteArray readFile(
const
QString &fileName );
79
bool
writeFile(
const
QString &fileName, QByteArray data );
80
bool
removeFile(
const
QString &fileName );
81
82
void
expire();
83
84
QFileInfoList cacheEntries();
85
};
86
87
#endif
// QGSRANGEREQUESTCACHE_H
QgsRangeRequestCache::TestQgsCopcProvider
friend class TestQgsCopcProvider
Definition
qgsrangerequestcache.h:69
QgsRangeRequestCache::clear
void clear()
Clears the cache removing all of the files.
Definition
qgsrangerequestcache.cpp:53
QgsRangeRequestCache::hasEntry
bool hasEntry(const QNetworkRequest &request)
Checks whether the range request exists in the cache.
Definition
qgsrangerequestcache.cpp:40
QgsRangeRequestCache::error
QString error() const
Returns the last error that occurred when manipulating the cache.
Definition
qgsrangerequestcache.h:67
QgsRangeRequestCache::setCacheDirectory
bool setCacheDirectory(const QString &path)
Set the Cache Directory object.
Definition
qgsrangerequestcache.cpp:62
QgsRangeRequestCache::entry
QByteArray entry(const QNetworkRequest &request)
Returns the range request data stored in the cache and an empty byte array if the data is not in the ...
Definition
qgsrangerequestcache.cpp:33
QgsRangeRequestCache::registerEntry
void registerEntry(const QNetworkRequest &request, QByteArray data)
Adds the range request data into the cache.
Definition
qgsrangerequestcache.cpp:46
QgsRangeRequestCache::QgsRangeRequestCache
QgsRangeRequestCache()
Definition
qgsrangerequestcache.cpp:30
QgsRangeRequestCache::setCacheSize
void setCacheSize(qint64 maxBytes)
Sets the cache size.
Definition
qgsrangerequestcache.cpp:79
Generated on
for QGIS API Documentation by
1.17.0