Qt 4.8
|
The QNetworkCacheMetaData class provides cache information. More...
#include <qabstractnetworkcache.h>
Public Types | |
typedef QHash< QNetworkRequest::Attribute, QVariant > | AttributesMap |
Synonym for QHash<QNetworkRequest::Attribute, QVariant> More... | |
typedef QPair< QByteArray, QByteArray > | RawHeader |
Synonym for QPair<QByteArray, QByteArray> More... | |
typedef QList< RawHeader > | RawHeaderList |
Synonym for QList<RawHeader> More... | |
Public Functions | |
AttributesMap | attributes () const |
Returns all the attributes stored with this cache item. More... | |
QDateTime | expirationDate () const |
Returns the date and time when the meta data expires. More... | |
bool | isValid () const |
Returns true if this network cache meta data has attributes that have been set otherwise false. More... | |
QDateTime | lastModified () const |
Returns the date and time when the meta data was last modified. More... | |
bool | operator!= (const QNetworkCacheMetaData &other) const |
Returns true if this meta data is not equal to the other meta data; otherwise returns false. More... | |
QNetworkCacheMetaData & | operator= (const QNetworkCacheMetaData &other) |
Makes a copy of the other QNetworkCacheMetaData and returns a reference to the copy. More... | |
bool | operator== (const QNetworkCacheMetaData &other) const |
Returns true if this meta data is equal to the other meta data; otherwise returns false. More... | |
QNetworkCacheMetaData () | |
Constructs an invalid network cache meta data. More... | |
QNetworkCacheMetaData (const QNetworkCacheMetaData &other) | |
Constructs a copy of the other QNetworkCacheMetaData. More... | |
RawHeaderList | rawHeaders () const |
Returns a list of all raw headers that are set in this meta data. More... | |
bool | saveToDisk () const |
Returns is this cache should be allowed to be stored on disk. More... | |
void | setAttributes (const AttributesMap &attributes) |
Sets all attributes of this cache item to be the map attributes. More... | |
void | setExpirationDate (const QDateTime &dateTime) |
Sets the date and time when the meta data expires to dateTime. More... | |
void | setLastModified (const QDateTime &dateTime) |
Sets the date and time when the meta data was last modified to dateTime. More... | |
void | setRawHeaders (const RawHeaderList &headers) |
Sets the raw headers to list. More... | |
void | setSaveToDisk (bool allow) |
Sets whether this network cache meta data and associated content should be allowed to be stored on disk to allow. More... | |
void | setUrl (const QUrl &url) |
Sets the URL this network cache meta data to to be url. More... | |
QUrl | url () const |
Returns the URL this network cache meta data is referring to. More... | |
~QNetworkCacheMetaData () | |
Destroys the network cache meta data. More... | |
Properties | |
QSharedDataPointer< QNetworkCacheMetaDataPrivate > | d |
Friends | |
class | QNetworkCacheMetaDataPrivate |
Related Functions | |
(Note that these are not member functions.) | |
QDataStream & | operator<< (QDataStream &out, const QNetworkCacheMetaData &metaData) |
Writes metaData to the out stream. More... | |
QDataStream & | operator>> (QDataStream &in, QNetworkCacheMetaData &metaData) |
Reads a QNetworkCacheMetaData from the stream in into metaData. More... | |
The QNetworkCacheMetaData class provides cache information.
QNetworkCacheMetaData provides information about a cache file including the url, when it was last modified, when the cache file was created, headers for file and if the file should be saved onto a disk.
Definition at line 62 of file qabstractnetworkcache.h.
Synonym for QHash<QNetworkRequest::Attribute, QVariant>
Definition at line 68 of file qabstractnetworkcache.h.
Synonym for QPair<QByteArray, QByteArray>
Definition at line 66 of file qabstractnetworkcache.h.
Synonym for QList<RawHeader>
Definition at line 67 of file qabstractnetworkcache.h.
QNetworkCacheMetaData::QNetworkCacheMetaData | ( | ) |
Constructs an invalid network cache meta data.
Definition at line 123 of file qabstractnetworkcache.cpp.
QNetworkCacheMetaData::QNetworkCacheMetaData | ( | const QNetworkCacheMetaData & | other | ) |
Constructs a copy of the other QNetworkCacheMetaData.
Definition at line 139 of file qabstractnetworkcache.cpp.
QNetworkCacheMetaData::~QNetworkCacheMetaData | ( | ) |
Destroys the network cache meta data.
Definition at line 131 of file qabstractnetworkcache.cpp.
QNetworkCacheMetaData::AttributesMap QNetworkCacheMetaData::attributes | ( | ) | const |
Returns all the attributes stored with this cache item.
Definition at line 301 of file qabstractnetworkcache.cpp.
Referenced by QNetworkAccessHttpBackend::fetchCacheMetaData(), QNetworkReplyImplPrivate::initCacheSaveDevice(), QNetworkCacheMetaDataPrivate::save(), QNetworkAccessCacheBackend::sendCacheContents(), QNetworkAccessHttpBackend::sendCacheContents(), and setAttributes().
QDateTime QNetworkCacheMetaData::expirationDate | ( | ) | const |
Returns the date and time when the meta data expires.
Definition at line 278 of file qabstractnetworkcache.cpp.
Referenced by QNetworkAccessHttpBackend::loadFromCacheIfAllowed(), and QNetworkCacheMetaDataPrivate::save().
bool QNetworkCacheMetaData::isValid | ( | ) | const |
Returns true if this network cache meta data has attributes that have been set otherwise false.
Definition at line 181 of file qabstractnetworkcache.cpp.
Referenced by QNetworkAccessHttpBackend::loadFromCacheIfAllowed(), QNetworkDiskCache::prepare(), QNetworkAccessCacheBackend::sendCacheContents(), and QNetworkAccessHttpBackend::sendCacheContents().
QDateTime QNetworkCacheMetaData::lastModified | ( | ) | const |
Returns the date and time when the meta data was last modified.
Definition at line 262 of file qabstractnetworkcache.cpp.
Referenced by QNetworkAccessHttpBackend::loadFromCacheIfAllowed(), and QNetworkCacheMetaDataPrivate::save().
|
inline |
Returns true if this meta data is not equal to the other meta data; otherwise returns false.
Definition at line 76 of file qabstractnetworkcache.h.
QNetworkCacheMetaData & QNetworkCacheMetaData::operator= | ( | const QNetworkCacheMetaData & | other | ) |
Makes a copy of the other QNetworkCacheMetaData and returns a reference to the copy.
Definition at line 147 of file qabstractnetworkcache.cpp.
bool QNetworkCacheMetaData::operator== | ( | const QNetworkCacheMetaData & | other | ) | const |
Returns true if this meta data is equal to the other meta data; otherwise returns false.
Definition at line 158 of file qabstractnetworkcache.cpp.
QNetworkCacheMetaData::RawHeaderList QNetworkCacheMetaData::rawHeaders | ( | ) | const |
Returns a list of all raw headers that are set in this meta data.
The list is in the same order that the headers were set.
Definition at line 244 of file qabstractnetworkcache.cpp.
Referenced by QCacheItem::canCompress(), QNetworkAccessHttpBackend::fetchCacheMetaData(), QNetworkAccessHttpBackend::loadFromCacheIfAllowed(), QNetworkDiskCache::prepare(), QNetworkAccessHttpBackend::replyDownloadMetaData(), QNetworkCacheMetaDataPrivate::save(), QNetworkAccessCacheBackend::sendCacheContents(), and QNetworkAccessHttpBackend::sendCacheContents().
bool QNetworkCacheMetaData::saveToDisk | ( | ) | const |
Returns is this cache should be allowed to be stored on disk.
Some cache implementations can keep these cache items in memory for performance reasons, but for security reasons they should not be written to disk.
Specifically with http, documents marked with Pragma: no-cache, or have a Cache-control set to no-store or no-cache or any https document that doesn't have "Cache-control: public" set will set the saveToDisk to false.
Definition at line 198 of file qabstractnetworkcache.cpp.
Referenced by QNetworkAccessHttpBackend::loadFromCacheIfAllowed(), QNetworkDiskCache::prepare(), QNetworkCacheMetaDataPrivate::save(), and QNetworkDiskCachePrivate::storeItem().
void QNetworkCacheMetaData::setAttributes | ( | const AttributesMap & | attributes | ) |
Sets all attributes of this cache item to be the map attributes.
Definition at line 316 of file qabstractnetworkcache.cpp.
Referenced by QNetworkAccessHttpBackend::fetchCacheMetaData(), and QNetworkReplyImplPrivate::initCacheSaveDevice().
void QNetworkCacheMetaData::setExpirationDate | ( | const QDateTime & | dateTime | ) |
Sets the date and time when the meta data expires to dateTime.
Definition at line 286 of file qabstractnetworkcache.cpp.
Referenced by QNetworkAccessHttpBackend::fetchCacheMetaData().
void QNetworkCacheMetaData::setLastModified | ( | const QDateTime & | dateTime | ) |
Sets the date and time when the meta data was last modified to dateTime.
Definition at line 270 of file qabstractnetworkcache.cpp.
Referenced by QNetworkAccessHttpBackend::fetchCacheMetaData().
void QNetworkCacheMetaData::setRawHeaders | ( | const RawHeaderList & | list | ) |
Sets the raw headers to list.
Definition at line 254 of file qabstractnetworkcache.cpp.
Referenced by QNetworkAccessHttpBackend::fetchCacheMetaData().
void QNetworkCacheMetaData::setSaveToDisk | ( | bool | allow | ) |
Sets whether this network cache meta data and associated content should be allowed to be stored on disk to allow.
Definition at line 209 of file qabstractnetworkcache.cpp.
Referenced by QNetworkAccessHttpBackend::fetchCacheMetaData().
void QNetworkCacheMetaData::setUrl | ( | const QUrl & | url | ) |
Sets the URL this network cache meta data to to be url.
The password and fragment are removed from the url.
Definition at line 231 of file qabstractnetworkcache.cpp.
Referenced by QNetworkReplyImplPrivate::initCacheSaveDevice().
QUrl QNetworkCacheMetaData::url | ( | ) | const |
Returns the URL this network cache meta data is referring to.
Definition at line 219 of file qabstractnetworkcache.cpp.
Referenced by QNetworkDiskCache::prepare(), QNetworkDiskCache::remove(), QNetworkCacheMetaDataPrivate::save(), setUrl(), QNetworkDiskCachePrivate::storeItem(), and QNetworkDiskCache::updateMetaData().
|
related |
Writes metaData to the out stream.
Definition at line 332 of file qabstractnetworkcache.cpp.
|
related |
Reads a QNetworkCacheMetaData from the stream in into metaData.
Definition at line 373 of file qabstractnetworkcache.cpp.
|
friend |
Definition at line 100 of file qabstractnetworkcache.h.
|
private |
Definition at line 101 of file qabstractnetworkcache.h.
Referenced by attributes(), expirationDate(), isValid(), lastModified(), QNetworkCacheMetaDataPrivate::load(), operator=(), operator==(), rawHeaders(), saveToDisk(), setAttributes(), setExpirationDate(), setLastModified(), setRawHeaders(), setSaveToDisk(), setUrl(), and url().