Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QNetworkCacheMetaData Class Reference

The QNetworkCacheMetaData class provides cache information. More...

#include <qabstractnetworkcache.h>

Collaboration diagram for QNetworkCacheMetaData:

Public Types

typedef std::pair< QByteArray, QByteArrayRawHeader
 Synonym for std::pair<QByteArray, QByteArray>
typedef QList< RawHeaderRawHeaderList
 Synonym for QList<RawHeader>
typedef QHash< QNetworkRequest::Attribute, QVariantAttributesMap
 Synonym for QHash<QNetworkRequest::Attribute, QVariant>

Public Member Functions

 QNetworkCacheMetaData ()
 Constructs an invalid network cache meta data.
 QNetworkCacheMetaData (const QNetworkCacheMetaData &other)
 Constructs a copy of the other QNetworkCacheMetaData.
 ~QNetworkCacheMetaData ()
 Destroys the network cache meta data.
QNetworkCacheMetaDataoperator= (QNetworkCacheMetaData &&other) noexcept
QNetworkCacheMetaDataoperator= (const QNetworkCacheMetaData &other)
 Makes a copy of the other QNetworkCacheMetaData and returns a reference to the copy.
void swap (QNetworkCacheMetaData &other) noexcept
bool operator== (const QNetworkCacheMetaData &other) const
 Returns true if this meta data is equal to the other meta data; otherwise returns false.
bool operator!= (const QNetworkCacheMetaData &other) const
 Returns true if this meta data is not equal to the other meta data; otherwise returns false.
bool isValid () const
 Returns true if this network cache meta data has attributes that have been set otherwise false.
QUrl url () const
 Returns the URL this network cache meta data is referring to.
void setUrl (const QUrl &url)
 Sets the URL this network cache meta data to be url.
RawHeaderList rawHeaders () const
 Returns a list of all raw headers that are set in this meta data.
void setRawHeaders (const RawHeaderList &headers)
 Sets the raw headers to list.
QHttpHeaders headers () const
void setHeaders (const QHttpHeaders &headers)
QDateTime lastModified () const
 Returns the date and time when the meta data was last modified.
void setLastModified (const QDateTime &dateTime)
 Sets the date and time when the meta data was last modified to dateTime.
QDateTime expirationDate () const
 Returns the date and time when the meta data expires.
void setExpirationDate (const QDateTime &dateTime)
 Sets the date and time when the meta data expires to dateTime.
bool saveToDisk () const
 Returns is this cache should be allowed to be stored on disk.
void setSaveToDisk (bool allow)
 Sets whether this network cache meta data and associated content should be allowed to be stored on disk to allow.
AttributesMap attributes () const
void setAttributes (const AttributesMap &attributes)

Friends

class QNetworkCacheMetaDataPrivate

(Note that these are not member symbols.)

QDataStreamoperator<< (QDataStream &out, const QNetworkCacheMetaData &metaData)
QDataStreamoperator>> (QDataStream &in, QNetworkCacheMetaData &metaData)

Detailed Description

The QNetworkCacheMetaData class provides cache information.

Since
4.5

\inmodule QtNetwork

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.

See also
QAbstractNetworkCache

Definition at line 23 of file qabstractnetworkcache.h.

Member Typedef Documentation

◆ AttributesMap

◆ RawHeader

Synonym for std::pair<QByteArray, QByteArray>

Definition at line 27 of file qabstractnetworkcache.h.

◆ RawHeaderList

Constructor & Destructor Documentation

◆ QNetworkCacheMetaData() [1/2]

QNetworkCacheMetaData::QNetworkCacheMetaData ( )

Constructs an invalid network cache meta data.

See also
isValid()

Definition at line 88 of file qabstractnetworkcache.cpp.

◆ QNetworkCacheMetaData() [2/2]

QNetworkCacheMetaData::QNetworkCacheMetaData ( const QNetworkCacheMetaData & other)

Constructs a copy of the other QNetworkCacheMetaData.

Definition at line 104 of file qabstractnetworkcache.cpp.

◆ ~QNetworkCacheMetaData()

QNetworkCacheMetaData::~QNetworkCacheMetaData ( )

Destroys the network cache meta data.

Definition at line 96 of file qabstractnetworkcache.cpp.

Member Function Documentation

◆ attributes()

QNetworkCacheMetaData::AttributesMap QNetworkCacheMetaData::attributes ( ) const
Since
4.6

Returns all the attributes stored with this cache item.

See also
setAttributes(), QNetworkRequest::Attribute

Definition at line 291 of file qabstractnetworkcache.cpp.

◆ expirationDate()

QDateTime QNetworkCacheMetaData::expirationDate ( ) const

Returns the date and time when the meta data expires.

Definition at line 271 of file qabstractnetworkcache.cpp.

◆ headers()

QHttpHeaders QNetworkCacheMetaData::headers ( ) const
Since
6.8

Returns headers in form of QHttpHeaders that are set in this meta data.

See also
setHeaders()

Definition at line 235 of file qabstractnetworkcache.cpp.

◆ isValid()

bool QNetworkCacheMetaData::isValid ( ) const

Returns true if this network cache meta data has attributes that have been set otherwise false.

Definition at line 149 of file qabstractnetworkcache.cpp.

◆ lastModified()

QDateTime QNetworkCacheMetaData::lastModified ( ) const

Returns the date and time when the meta data was last modified.

Definition at line 255 of file qabstractnetworkcache.cpp.

◆ operator!=()

bool QNetworkCacheMetaData::operator!= ( const QNetworkCacheMetaData & other) const
inline

Returns true if this meta data is not equal to the other meta data; otherwise returns false.

See also
operator==()

Definition at line 42 of file qabstractnetworkcache.h.

◆ operator=() [1/2]

QNetworkCacheMetaData & QNetworkCacheMetaData::operator= ( const QNetworkCacheMetaData & other)

Makes a copy of the other QNetworkCacheMetaData and returns a reference to the copy.

Definition at line 112 of file qabstractnetworkcache.cpp.

◆ operator=() [2/2]

QNetworkCacheMetaData & QNetworkCacheMetaData::operator= ( QNetworkCacheMetaData && other)
inlinenoexcept

Definition at line 35 of file qabstractnetworkcache.h.

◆ operator==()

bool QNetworkCacheMetaData::operator== ( const QNetworkCacheMetaData & other) const

Returns true if this meta data is equal to the other meta data; otherwise returns false.

See also
operator!=()

Definition at line 129 of file qabstractnetworkcache.cpp.

◆ rawHeaders()

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.

See also
setRawHeaders(), headers()

Definition at line 213 of file qabstractnetworkcache.cpp.

◆ saveToDisk()

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 with Cache-control set to no-store or any https document that doesn't have "Cache-control: public" set will set the saveToDisk to false.

See also
setSaveToDisk()

Definition at line 166 of file qabstractnetworkcache.cpp.

◆ setAttributes()

void QNetworkCacheMetaData::setAttributes ( const AttributesMap & attributes)
Since
4.6

Sets all attributes of this cache item to be the map attributes.

See also
attributes(), QNetworkRequest::setAttribute()

Definition at line 303 of file qabstractnetworkcache.cpp.

◆ setExpirationDate()

void QNetworkCacheMetaData::setExpirationDate ( const QDateTime & dateTime)

Sets the date and time when the meta data expires to dateTime.

Definition at line 279 of file qabstractnetworkcache.cpp.

◆ setHeaders()

void QNetworkCacheMetaData::setHeaders ( const QHttpHeaders & headers)
Since
6.8

Sets the headers of this network cache meta data to headers.

See also
headers()

Definition at line 247 of file qabstractnetworkcache.cpp.

◆ setLastModified()

void QNetworkCacheMetaData::setLastModified ( const QDateTime & dateTime)

Sets the date and time when the meta data was last modified to dateTime.

Definition at line 263 of file qabstractnetworkcache.cpp.

◆ setRawHeaders()

void QNetworkCacheMetaData::setRawHeaders ( const RawHeaderList & list)

Sets the raw headers to list.

See also
rawHeaders(), setHeaders()

Definition at line 223 of file qabstractnetworkcache.cpp.

◆ setSaveToDisk()

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.

See also
saveToDisk()

Definition at line 177 of file qabstractnetworkcache.cpp.

◆ setUrl()

void QNetworkCacheMetaData::setUrl ( const QUrl & url)

Sets the URL this network cache meta data to be url.

The password and fragment are removed from the url.

See also
url()

Definition at line 199 of file qabstractnetworkcache.cpp.

◆ swap()

void QNetworkCacheMetaData::swap ( QNetworkCacheMetaData & other)
inlinenoexcept
Since
5.0 \memberswap{metadata instance}

Definition at line 38 of file qabstractnetworkcache.h.

◆ url()

QUrl QNetworkCacheMetaData::url ( ) const

Returns the URL this network cache meta data is referring to.

See also
setUrl()

Definition at line 187 of file qabstractnetworkcache.cpp.

◆ operator<<()

QDataStream & operator<< ( QDataStream & out,
const QNetworkCacheMetaData & metaData )
related
Since
4.5

Writes metaData to the out stream.

See also
{Serializing Qt Data Types}

Definition at line 316 of file qabstractnetworkcache.cpp.

◆ operator>>()

QDataStream & operator>> ( QDataStream & in,
QNetworkCacheMetaData & metaData )
related
Since
4.5

Reads a QNetworkCacheMetaData from the stream in into metaData.

See also
{Serializing Qt Data Types}

Definition at line 354 of file qabstractnetworkcache.cpp.

◆ QNetworkCacheMetaDataPrivate

friend class QNetworkCacheMetaDataPrivate
friend

Definition at line 69 of file qabstractnetworkcache.h.


The documentation for this class was generated from the following files: