QNetworkCacheMetaData Class

The QNetworkCacheMetaData class provides cache information. 更多...

頭: #include <QNetworkCacheMetaData>
qmake: QT += network
Since: Qt 4.5

該類在 Qt 4.5 引入。

公共類型

typedef AttributesMap
typedef RawHeader
typedef RawHeaderList

公共函數

QNetworkCacheMetaData (const QNetworkCacheMetaData & other )
QNetworkCacheMetaData ()
QNetworkCacheMetaData & operator= (const QNetworkCacheMetaData & other )
~QNetworkCacheMetaData ()
QNetworkCacheMetaData::AttributesMap attributes () const
QDateTime expirationDate () const
bool isValid () const
QDateTime lastModified () const
QNetworkCacheMetaData::RawHeaderList rawHeaders () const
bool saveToDisk () const
void setAttributes (const QNetworkCacheMetaData::AttributesMap & 屬性 )
void setExpirationDate (const QDateTime & dateTime )
void setLastModified (const QDateTime & dateTime )
void setRawHeaders (const QNetworkCacheMetaData::RawHeaderList & list )
void setSaveToDisk (bool allow )
void setUrl (const QUrl & url )
void swap (QNetworkCacheMetaData & other )
QUrl url () const
bool operator!= (const QNetworkCacheMetaData & other ) const
bool operator== (const QNetworkCacheMetaData & other ) const
QDataStream & operator<< (QDataStream & out , const QNetworkCacheMetaData & metaData )
QDataStream & operator>> (QDataStream & in , QNetworkCacheMetaData & metaData )

詳細描述

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.

另請參閱 QAbstractNetworkCache .

成員類型文檔編製

typedef QNetworkCacheMetaData:: AttributesMap

同義詞 QHash < QNetworkRequest::Attribute , QVariant >

typedef QNetworkCacheMetaData:: RawHeader

同義詞 QPair < QByteArray , QByteArray >

typedef QNetworkCacheMetaData:: RawHeaderList

同義詞 QList < RawHeader >

成員函數文檔編製

QNetworkCacheMetaData:: QNetworkCacheMetaData (const QNetworkCacheMetaData & other )

構造副本為 other QNetworkCacheMetaData.

QNetworkCacheMetaData:: QNetworkCacheMetaData ()

Constructs an invalid network cache meta data.

另請參閱 isValid ().

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

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

QNetworkCacheMetaData:: ~QNetworkCacheMetaData ()

Destroys the network cache meta data.

QNetworkCacheMetaData::AttributesMap QNetworkCacheMetaData:: attributes () const

Returns all the attributes stored with this cache item.

該函數在 Qt 4.6 引入。

另請參閱 setAttributes () 和 QNetworkRequest::Attribute .

QDateTime QNetworkCacheMetaData:: expirationDate () const

Returns the date and time when the meta data expires.

另請參閱 setExpirationDate ().

bool QNetworkCacheMetaData:: isValid () const

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

QDateTime QNetworkCacheMetaData:: lastModified () const

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

另請參閱 setLastModified ().

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.

另請參閱 setRawHeaders ().

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.

另請參閱 setSaveToDisk ().

void QNetworkCacheMetaData:: setAttributes (const QNetworkCacheMetaData::AttributesMap & 屬性 )

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

該函數在 Qt 4.6 引入。

另請參閱 attributes () 和 QNetworkRequest::setAttribute ().

void QNetworkCacheMetaData:: setExpirationDate (const QDateTime & dateTime )

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

另請參閱 expirationDate ().

void QNetworkCacheMetaData:: setLastModified (const QDateTime & dateTime )

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

另請參閱 lastModified ().

void QNetworkCacheMetaData:: setRawHeaders (const QNetworkCacheMetaData::RawHeaderList & list )

Sets the raw headers to list .

另請參閱 rawHeaders ().

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 .

另請參閱 saveToDisk ().

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.

另請參閱 url ().

void QNetworkCacheMetaData:: swap ( QNetworkCacheMetaData & other )

Swaps this metadata instance with other 。此函數非常快且從不失敗。

該函數在 Qt 5.0 引入。

QUrl QNetworkCacheMetaData:: url () const

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

另請參閱 setUrl ().

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

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

另請參閱 operator== ().

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

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

另請參閱 operator!= ().

相關非成員

QDataStream & operator<< ( QDataStream & out , const QNetworkCacheMetaData & metaData )

寫入 metaData out stream.

該函數在 Qt 4.5 引入。

另請參閱 序列化 Qt 數據類型 .

QDataStream & operator>> ( QDataStream & in , QNetworkCacheMetaData & metaData )

讀取 QNetworkCacheMetaData 從流 in into metaData .

該函數在 Qt 4.5 引入。

另請參閱 序列化 Qt 數據類型 .