43 #include "QtCore/qpointer.h" 44 #include "QtCore/qdatetime.h" 45 #include "QtCore/qqueue.h" 77 : older(0), newer(0), object(0), useCount(0)
90 if (!
key.isEmpty() && Ptr()->hasEntry(
key))
91 qWarning() <<
"QNetworkAccessCache: object" << (
void*)
this <<
"key" <<
key 92 <<
"destroyed without being removed from cache first!";
107 : oldest(0), newest(0)
124 for ( ; it !=
end; ++
it) {
125 it->object->key.clear();
126 it->object->dispose();
147 Node *
const node = &it.value();
176 Node *
const node = &it.value();
178 bool wasOldest =
false;
206 interval = (interval + 15) & ~16;
255 qWarning(
"QNetworkAccessCache::addEntry: overriding active cache entry '%s'",
276 Node *node = &it.value();
283 receiver.object = target;
284 receiver.member = member;
304 if (it->useCount > 0) {
305 if (it->object->shareable) {
327 qWarning(
"QNetworkAccessCache::releaseEntry: trying to release key '%s' that is not in cache",
332 Node *node = &it.value();
343 if (!receiver.object.isNull()) {
363 qWarning(
"QNetworkAccessCache::removeEntry: trying to remove key '%s' that is not in cache",
368 Node *node = &it.value();
372 qWarning(
"QNetworkAccessCache::removeEntry: removing active cache entry '%s'",
QDateTime addSecs(int secs) const
Returns a QDateTime object containing a datetime s seconds later than the datetime of this object (or...
bool requestEntry(const QByteArray &key, QObject *target, const char *member)
#define QT_END_NAMESPACE
This macro expands to.
void timerEvent(QTimerEvent *)
This event handler can be reimplemented in a subclass to receive timer events for the object...
void clear()
Removes all items from the hash.
int remove(const Key &key)
Removes all the items that have the key from the hash.
#define it(className, varName)
The QByteArray class provides an array of bytes.
void entryReady(QNetworkAccessCache::CacheableObject *)
CacheableObject * requestEntryNow(const QByteArray &key)
The QObject class is the base class of all Qt objects.
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
QQueue< Receiver > receiverQueue
#define QT_BEGIN_NAMESPACE
This macro expands to.
void addEntry(const QByteArray &key, CacheableObject *entry)
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
virtual ~CacheableObject()
int secsTo(const QDateTime &) const
Returns the number of seconds from this datetime to the other datetime.
Q_CORE_EXPORT void qWarning(const char *,...)
bool unlinkEntry(const QByteArray &key)
Removes the entry pointed by key from the linked list.
bool emitEntryReady(Node *node, QObject *target, const char *member)
void stop()
Stops the timer.
const char * constData() const
Returns a pointer to the data stored in the byte array.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
void enqueue(const T &t)
Adds value t to the tail of the queue.
bool hasEntry(const QByteArray &key) const
The QDateTime class provides date and time functions.
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the hash...
The QTimerEvent class contains parameters that describe a timer event.
void linkEntry(const QByteArray &key)
Appens the entry given by key to the end of the linked list.
void setExpires(bool enable)
static QDateTime currentDateTime()
Returns the current datetime, as reported by the system clock, in the local time zone.
iterator begin()
Returns an STL-style iterator pointing to the first item in the hash.
void setShareable(bool enable)
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
void releaseEntry(const QByteArray &key)
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
T dequeue()
Removes the head item in the queue and returns it.
static const KeyPair *const end
void removeEntry(const QByteArray &key)
void clear()
Clears the contents of the byte array and makes it empty.
iterator Iterator
Qt-style synonym for QHash::iterator.
void start(int msec, QObject *obj)
Starts (or restarts) the timer with a msec milliseconds timeout.