<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QAbstractNetworkCache Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QAbstractNetworkCache Class Reference<br /><sup><sup>[<a href="qtnetwork.html">QtNetwork</a> module]</sup></sup></h1><p>The QAbstractNetworkCache class provides the interface for cache implementations. <a href="#details">More...</a></p> <p>Inherits <a href="qobject.html">QObject</a>.</p><p>Inherited by <a href="qnetworkdiskcache.html">QNetworkDiskCache</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qabstractnetworkcache.html#QAbstractNetworkCache">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" />int <b><a href="qabstractnetworkcache.html#cacheSize">cacheSize</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractnetworkcache.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" />QIODevice <b><a href="qabstractnetworkcache.html#data">data</a></b> (<i>self</i>, QUrl <i>url</i>)</li><li><div class="fn" /><b><a href="qabstractnetworkcache.html#insert">insert</a></b> (<i>self</i>, QIODevice <i>device</i>)</li><li><div class="fn" />QNetworkCacheMetaData <b><a href="qabstractnetworkcache.html#metaData">metaData</a></b> (<i>self</i>, QUrl <i>url</i>)</li><li><div class="fn" />QIODevice <b><a href="qabstractnetworkcache.html#prepare">prepare</a></b> (<i>self</i>, QNetworkCacheMetaData <i>metaData</i>)</li><li><div class="fn" />bool <b><a href="qabstractnetworkcache.html#remove">remove</a></b> (<i>self</i>, QUrl <i>url</i>)</li><li><div class="fn" /><b><a href="qabstractnetworkcache.html#updateMetaData">updateMetaData</a></b> (<i>self</i>, QNetworkCacheMetaData <i>metaData</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAbstractNetworkCache class provides the interface for cache implementations.</p> <p>QAbstractNetworkCache is the base class for every standard cache that is used be <a href="qnetworkaccessmanager.html">QNetworkAccessManager</a>. QAbstractNetworkCache is an abstract class and cannot be instantiated.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractNetworkCache" />QAbstractNetworkCache.__init__ (<i>self</i>, <a href="qobject.html">QObject</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs an abstract network cache with the given <i>parent</i>.</p> <h3 class="fn"><a name="cacheSize" />int QAbstractNetworkCache.cacheSize (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the current size taken up by the cache. Depending upon the cache implementation this might be disk or memory size.</p> <p>In the base class this is a pure virtual function.</p> <p><b>See also</b> <a href="qabstractnetworkcache.html#clear">clear</a>().</p> <h3 class="fn"><a name="clear" />QAbstractNetworkCache.clear (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void clear()</tt>.</p><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Removes all items from the cache. Unless there was failures clearing the cache <a href="qabstractnetworkcache.html#cacheSize">cacheSize</a>() should return 0 after a call to clear.</p> <p>In the base class this is a pure virtual function.</p> <p><b>See also</b> <a href="qabstractnetworkcache.html#cacheSize">cacheSize</a>() and <a href="qabstractnetworkcache.html#remove">remove</a>().</p> <h3 class="fn"><a name="data" /><a href="qiodevice.html">QIODevice</a> QAbstractNetworkCache.data (<i>self</i>, <a href="qurl.html">QUrl</a> <i>url</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the data associated with <i>url</i>.</p> <p>It is up to the application that requests the data to delete the <a href="qiodevice.html">QIODevice</a> when done with it.</p> <p>If there is no cache for <i>url</i>, the url is invalid, or if there is an internal cache error 0 is returned.</p> <p>In the base class this is a pure virtual function.</p> <p><b>See also</b> <a href="qabstractnetworkcache.html#metaData">metaData</a>() and <a href="qabstractnetworkcache.html#prepare">prepare</a>().</p> <h3 class="fn"><a name="insert" />QAbstractNetworkCache.insert (<i>self</i>, <a href="qiodevice.html">QIODevice</a> <i>device</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Inserts the data in <i>device</i> and the prepared meta data into the cache. After this function is called the data and meta data should be retrievable using <a href="qabstractnetworkcache.html#data">data</a>() and <a href="qabstractnetworkcache.html#metaData">metaData</a>().</p> <p>To cancel a prepared inserted call <a href="qabstractnetworkcache.html#remove">remove</a>() on the metadata's url.</p> <p>In the base class this is a pure virtual function.</p> <p><b>See also</b> <a href="qabstractnetworkcache.html#prepare">prepare</a>() and <a href="qabstractnetworkcache.html#remove">remove</a>().</p> <h3 class="fn"><a name="metaData" /><a href="qnetworkcachemetadata.html">QNetworkCacheMetaData</a> QAbstractNetworkCache.metaData (<i>self</i>, <a href="qurl.html">QUrl</a> <i>url</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the meta data for the url <i>url</i>.</p> <p>If the url is valid and the cache contains the data for url, a valid <a href="qnetworkcachemetadata.html">QNetworkCacheMetaData</a> is returned.</p> <p>In the base class this is a pure virtual function.</p> <p><b>See also</b> <a href="qabstractnetworkcache.html#updateMetaData">updateMetaData</a>() and <a href="qabstractnetworkcache.html#data">data</a>().</p> <h3 class="fn"><a name="prepare" /><a href="qiodevice.html">QIODevice</a> QAbstractNetworkCache.prepare (<i>self</i>, <a href="qnetworkcachemetadata.html">QNetworkCacheMetaData</a> <i>metaData</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the device that should be populated with the data for the cache item <i>metaData</i>. When all of the data has been written <a href="qabstractnetworkcache.html#insert">insert</a>() should be called. If metaData is invalid or the url in the metadata is invalid 0 is returned.</p> <p>The cache owns the device and will take care of deleting it when it is inserted or removed.</p> <p>To cancel a prepared inserted call <a href="qabstractnetworkcache.html#remove">remove</a>() on the metadata's url.</p> <p>In the base class this is a pure virtual function.</p> <p><b>See also</b> <a href="qabstractnetworkcache.html#remove">remove</a>(), <a href="qabstractnetworkcache.html#updateMetaData">updateMetaData</a>(), and <a href="qabstractnetworkcache.html#insert">insert</a>().</p> <h3 class="fn"><a name="remove" />bool QAbstractNetworkCache.remove (<i>self</i>, <a href="qurl.html">QUrl</a> <i>url</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Removes the cache entry for <i>url</i>, returning true if success otherwise false.</p> <p>In the base class this is a pure virtual function.</p> <p><b>See also</b> <a href="qabstractnetworkcache.html#clear">clear</a>() and <a href="qabstractnetworkcache.html#prepare">prepare</a>().</p> <h3 class="fn"><a name="updateMetaData" />QAbstractNetworkCache.updateMetaData (<i>self</i>, <a href="qnetworkcachemetadata.html">QNetworkCacheMetaData</a> <i>metaData</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Updates the cache meta date for the metaData's url to <i>metaData</i></p> <p>If the cache does not contains a cache item for the url then no action is taken.</p> <p>In the base class this is a pure virtual function.</p> <p><b>See also</b> <a href="qabstractnetworkcache.html#metaData">metaData</a>() and <a href="qabstractnetworkcache.html#prepare">prepare</a>().</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>