qabstractnetworkcache.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/access/qabstractnetworkcache.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6class QNetworkCacheMetaDataPrivate : public QSharedData-
7{-
8-
9public:-
10 QNetworkCacheMetaDataPrivate()-
11 : QSharedData()-
12 , saveToDisk(true)-
13 {}
executed 708 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
708
14-
15 bool operator==(const QNetworkCacheMetaDataPrivate &other) const-
16 {-
17 return
executed 372 times by 4 tests: return url == other.url && lastModified == other.lastModified && expirationDate == other.expirationDate && headers == other.headers && saveToDisk == other.saveToDisk;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
372
18 url == other.url
executed 372 times by 4 tests: return url == other.url && lastModified == other.lastModified && expirationDate == other.expirationDate && headers == other.headers && saveToDisk == other.saveToDisk;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
372
19 && lastModified == other.lastModified
executed 372 times by 4 tests: return url == other.url && lastModified == other.lastModified && expirationDate == other.expirationDate && headers == other.headers && saveToDisk == other.saveToDisk;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
372
20 && expirationDate == other.expirationDate
executed 372 times by 4 tests: return url == other.url && lastModified == other.lastModified && expirationDate == other.expirationDate && headers == other.headers && saveToDisk == other.saveToDisk;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
372
21 && headers == other.headers
executed 372 times by 4 tests: return url == other.url && lastModified == other.lastModified && expirationDate == other.expirationDate && headers == other.headers && saveToDisk == other.saveToDisk;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
372
22 && saveToDisk == other.saveToDisk;
executed 372 times by 4 tests: return url == other.url && lastModified == other.lastModified && expirationDate == other.expirationDate && headers == other.headers && saveToDisk == other.saveToDisk;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
372
23 }-
24-
25 QUrl url;-
26 QDateTime lastModified;-
27 QDateTime expirationDate;-
28 QNetworkCacheMetaData::RawHeaderList headers;-
29 QNetworkCacheMetaData::AttributesMap attributes;-
30 bool saveToDisk;-
31-
32 static void save(QDataStream &out, const QNetworkCacheMetaData &metaData);-
33 static void load(QDataStream &in, QNetworkCacheMetaData &metaData);-
34};-
35namespace { namespace Q_QGS_metadata_shared_invalid { typedef QNetworkCacheMetaDataPrivate Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • tst_qabstractnetworkcache - unknown status
  • tst_qnetworkcachemetadata - unknown status
  • tst_qnetworkdiskcache - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 3 times by 3 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qabstractnetworkcache - unknown status
  • tst_qnetworkcachemetadata - unknown status
  • tst_qnetworkdiskcache - unknown status
}
executed 3 times by 3 tests: end of block
Executed by:
  • tst_qabstractnetworkcache - unknown status
  • tst_qnetworkcachemetadata - unknown status
  • tst_qnetworkdiskcache - unknown status
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 337 times by 4 tests: return &holder.value;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
&holder.value;
executed 337 times by 4 tests: return &holder.value;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
} } } static QGlobalStatic<QNetworkCacheMetaDataPrivate, Q_QGS_metadata_shared_invalid::innerFunction, Q_QGS_metadata_shared_invalid::guard> metadata_shared_invalid;
0-337
36QNetworkCacheMetaData::QNetworkCacheMetaData()-
37 : d(new QNetworkCacheMetaDataPrivate)-
38{-
39}
executed 704 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
704
40-
41-
42-
43-
44QNetworkCacheMetaData::~QNetworkCacheMetaData()-
45{-
46-
47}-
48-
49-
50-
51-
52QNetworkCacheMetaData::QNetworkCacheMetaData(const QNetworkCacheMetaData &other)-
53 : d(other.d)-
54{-
55}
executed 335 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
335
56-
57-
58-
59-
60QNetworkCacheMetaData &QNetworkCacheMetaData::operator=(const QNetworkCacheMetaData &other)-
61{-
62 d = other.d;-
63 return
executed 92 times by 4 tests: return *this;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
*this;
executed 92 times by 4 tests: return *this;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
92
64}-
65bool QNetworkCacheMetaData::operator==(const QNetworkCacheMetaData &other) const-
66{-
67 if (d == other.d
d == other.dDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_qnetworkcachemetadata - unknown status
FALSEevaluated 35 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
)
7-35
68 return
executed 7 times by 1 test: return true;
Executed by:
  • tst_qnetworkcachemetadata - unknown status
true;
executed 7 times by 1 test: return true;
Executed by:
  • tst_qnetworkcachemetadata - unknown status
7
69 if (d && other.d)-
70 return
executed 35 times by 4 tests: return *d == *other.d;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
*d == *other.d;
executed 35 times by 4 tests: return *d == *other.d;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
35
71 return
never executed: return false;
false;
never executed: return false;
0
72}-
73bool QNetworkCacheMetaData::isValid() const-
74{-
75 return
executed 337 times by 4 tests: return !(*d == *metadata_shared_invalid());
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
!(*d == *metadata_shared_invalid());
executed 337 times by 4 tests: return !(*d == *metadata_shared_invalid());
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
337
76}-
77bool QNetworkCacheMetaData::saveToDisk() const-
78{-
79 return
executed 310 times by 4 tests: return d->saveToDisk;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
d->saveToDisk;
executed 310 times by 4 tests: return d->saveToDisk;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
310
80}-
81-
82-
83-
84-
85-
86-
87-
88void QNetworkCacheMetaData::setSaveToDisk(bool allow)-
89{-
90 d->saveToDisk = allow;-
91}
executed 79 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
79
92-
93-
94-
95-
96-
97-
98QUrl QNetworkCacheMetaData::url() const-
99{-
100 return
executed 692 times by 4 tests: return d->url;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
d->url;
executed 692 times by 4 tests: return d->url;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
692
101}-
102void QNetworkCacheMetaData::setUrl(const QUrl &url)-
103{-
104 d->url = url;-
105 d->url.setPassword(QString());-
106 d->url.setFragment(QString());-
107}
executed 120 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
120
108-
109-
110-
111-
112-
113-
114-
115QNetworkCacheMetaData::RawHeaderList QNetworkCacheMetaData::rawHeaders() const-
116{-
117 return
executed 501 times by 4 tests: return d->headers;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
d->headers;
executed 501 times by 4 tests: return d->headers;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
501
118}-
119-
120-
121-
122-
123-
124-
125void QNetworkCacheMetaData::setRawHeaders(const RawHeaderList &list)-
126{-
127 d->headers = list;-
128}
executed 98 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
98
129-
130-
131-
132-
133QDateTime QNetworkCacheMetaData::lastModified() const-
134{-
135 return
executed 131 times by 4 tests: return d->lastModified;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
d->lastModified;
executed 131 times by 4 tests: return d->lastModified;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
131
136}-
137-
138-
139-
140-
141void QNetworkCacheMetaData::setLastModified(const QDateTime &dateTime)-
142{-
143 d->lastModified = dateTime;-
144}
executed 43 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
43
145-
146-
147-
148-
149QDateTime QNetworkCacheMetaData::expirationDate() const-
150{-
151 return
executed 125 times by 4 tests: return d->expirationDate;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
d->expirationDate;
executed 125 times by 4 tests: return d->expirationDate;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
125
152}-
153-
154-
155-
156-
157void QNetworkCacheMetaData::setExpirationDate(const QDateTime &dateTime)-
158{-
159 d->expirationDate = dateTime;-
160}
executed 49 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
49
161QNetworkCacheMetaData::AttributesMap QNetworkCacheMetaData::attributes() const-
162{-
163 return
executed 139 times by 4 tests: return d->attributes;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
d->attributes;
executed 139 times by 4 tests: return d->attributes;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
139
164}-
165void QNetworkCacheMetaData::setAttributes(const AttributesMap &attributes)-
166{-
167 d->attributes = attributes;-
168}
executed 70 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
70
169QDataStream &operator<<(QDataStream &out, const QNetworkCacheMetaData &metaData)-
170{-
171 QNetworkCacheMetaDataPrivate::save(out, metaData);-
172 return
executed 91 times by 4 tests: return out;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
out;
executed 91 times by 4 tests: return out;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
91
173}-
174-
175static inline QDataStream &operator<<(QDataStream &out, const QNetworkCacheMetaData::AttributesMap &hash)-
176{-
177 out << quint32(hash.size());-
178 QNetworkCacheMetaData::AttributesMap::ConstIterator it = hash.end();-
179 QNetworkCacheMetaData::AttributesMap::ConstIterator begin = hash.begin();-
180 while (it != begin
it != beginDescription
TRUEevaluated 118 times by 3 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
FALSEevaluated 91 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
) {
91-118
181 --it;-
182 out << int(it.key()) << it.value();-
183 }
executed 118 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
118
184 return
executed 91 times by 4 tests: return out;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
out;
executed 91 times by 4 tests: return out;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
91
185}-
186-
187void QNetworkCacheMetaDataPrivate::save(QDataStream &out, const QNetworkCacheMetaData &metaData)-
188{-
189-
190-
191 out << metaData.url();-
192 out << metaData.expirationDate();-
193 out << metaData.lastModified();-
194 out << metaData.saveToDisk();-
195 out << metaData.attributes();-
196 out << metaData.rawHeaders();-
197}
executed 91 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
91
198QDataStream &operator>>(QDataStream &in, QNetworkCacheMetaData &metaData)-
199{-
200 QNetworkCacheMetaDataPrivate::load(in, metaData);-
201 return
executed 86 times by 4 tests: return in;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
in;
executed 86 times by 4 tests: return in;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
86
202}-
203-
204static inline QDataStream &operator>>(QDataStream &in, QNetworkCacheMetaData::AttributesMap &hash)-
205{-
206 hash.clear();-
207 QDataStream::Status oldStatus = in.status();-
208 in.resetStatus();-
209 hash.clear();-
210-
211 quint32 n;-
212 in >> n;-
213-
214 for (quint32 i = 0; i < n
i < nDescription
TRUEevaluated 126 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
FALSEevaluated 86 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
; ++i) {
86-126
215 if (in.status() != QDataStream::Ok
in.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 126 times by 2 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
)
0-126
216 break;
never executed: break;
0
217-
218 int k;-
219 QVariant t;-
220 in >> k >> t;-
221 hash.insertMulti(QNetworkRequest::Attribute(k), t);-
222 }
executed 126 times by 2 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
126
223-
224 if (in.status() != QDataStream::Ok
in.status() != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 86 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
)
0-86
225 hash.clear();
never executed: hash.clear();
0
226 if (oldStatus != QDataStream::Ok
oldStatus != QDataStream::OkDescription
TRUEnever evaluated
FALSEevaluated 86 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
)
0-86
227 in.setStatus(oldStatus);
never executed: in.setStatus(oldStatus);
0
228 return
executed 86 times by 4 tests: return in;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
in;
executed 86 times by 4 tests: return in;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
86
229}-
230-
231void QNetworkCacheMetaDataPrivate::load(QDataStream &in, QNetworkCacheMetaData &metaData)-
232{-
233 in >> metaData.d->url;-
234 in >> metaData.d->expirationDate;-
235 in >> metaData.d->lastModified;-
236 in >> metaData.d->saveToDisk;-
237 in >> metaData.d->attributes;-
238 in >> metaData.d->headers;-
239}
executed 86 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_qnetworkcachemetadata - unknown status
86
240QAbstractNetworkCache::QAbstractNetworkCache(QObject *parent)-
241 : QObject(*new QAbstractNetworkCachePrivate, parent)-
242{-
243}
executed 23 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
23
244-
245-
246-
247-
248QAbstractNetworkCache::QAbstractNetworkCache(QAbstractNetworkCachePrivate &dd, QObject *parent)-
249 : QObject(dd, parent)-
250{-
251}
executed 66 times by 3 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
66
252QAbstractNetworkCache::~QAbstractNetworkCache()-
253{-
254}-
255-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9