access/qabstractnetworkcache.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6class QNetworkCacheMetaDataPrivate : public QSharedData -
7{ -
8 -
9public: -
10 QNetworkCacheMetaDataPrivate() -
11 : QSharedData() -
12 , saveToDisk(true) -
13 {}
executed: }
Execution Count:676
676
14 -
15 bool operator==(const QNetworkCacheMetaDataPrivate &other) const -
16 { -
17 return 358
18 url == other.url 358
19 && lastModified == other.lastModified 358
20 && expirationDate == other.expirationDate 358
21 && headers == other.headers 358
22 && saveToDisk == other.saveToDisk;
executed: return url == other.url && lastModified == other.lastModified && expirationDate == other.expirationDate && headers == other.headers && saveToDisk == other.saveToDisk;
Execution Count:358
358
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}; -
35static QNetworkCacheMetaDataPrivate *metadata_shared_invalid() { static QGlobalStatic<QNetworkCacheMetaDataPrivate > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QNetworkCacheMetaDataPrivate *x = new QNetworkCacheMetaDataPrivate; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QNetworkCacheMetaDataPrivate > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:321
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:317
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-321
36QNetworkCacheMetaData::QNetworkCacheMetaData() -
37 : d(new QNetworkCacheMetaDataPrivate) -
38{ -
39}
executed: }
Execution Count:672
672
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: }
Execution Count:336
336
56 -
57 -
58 -
59 -
60QNetworkCacheMetaData &QNetworkCacheMetaData::operator=(const QNetworkCacheMetaData &other) -
61{ -
62 d = other.d; -
63 return *this;
executed: return *this;
Execution Count:488
488
64} -
65bool QNetworkCacheMetaData::operator==(const QNetworkCacheMetaData &other) const -
66{ -
67 if (d == other.d)
evaluated: d == other.d
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:37
7-37
68 return true;
executed: return true;
Execution Count:7
7
69 if (d && other.d)
partially evaluated: d
TRUEFALSE
yes
Evaluation Count:37
no
Evaluation Count:0
partially evaluated: other.d
TRUEFALSE
yes
Evaluation Count:37
no
Evaluation Count:0
0-37
70 return *d == *other.d;
executed: return *d == *other.d;
Execution Count:37
37
71 return false;
never executed: return false;
0
72} -
73bool QNetworkCacheMetaData::isValid() const -
74{ -
75 return !(*d == *metadata_shared_invalid());
executed: return !(*d == *metadata_shared_invalid());
Execution Count:321
321
76} -
77bool QNetworkCacheMetaData::saveToDisk() const -
78{ -
79 return d->saveToDisk;
executed: return d->saveToDisk;
Execution Count:220
220
80} -
81 -
82 -
83 -
84 -
85 -
86 -
87 -
88void QNetworkCacheMetaData::setSaveToDisk(bool allow) -
89{ -
90 d->saveToDisk = allow; -
91}
executed: }
Execution Count:81
81
92 -
93 -
94 -
95 -
96 -
97 -
98QUrl QNetworkCacheMetaData::url() const -
99{ -
100 return d->url;
executed: return d->url;
Execution Count:682
682
101} -
102void QNetworkCacheMetaData::setUrl(const QUrl &url) -
103{ -
104 d->url = url; -
105 d->url.setPassword(QString()); -
106 d->url.setFragment(QString()); -
107}
executed: }
Execution Count:114
114
108 -
109 -
110 -
111 -
112 -
113 -
114 -
115QNetworkCacheMetaData::RawHeaderList QNetworkCacheMetaData::rawHeaders() const -
116{ -
117 return d->headers;
executed: return d->headers;
Execution Count:494
494
118} -
119 -
120 -
121 -
122 -
123 -
124 -
125void QNetworkCacheMetaData::setRawHeaders(const RawHeaderList &list) -
126{ -
127 d->headers = list; -
128}
executed: }
Execution Count:94
94
129 -
130 -
131 -
132 -
133QDateTime QNetworkCacheMetaData::lastModified() const -
134{ -
135 return d->lastModified;
executed: return d->lastModified;
Execution Count:126
126
136} -
137 -
138 -
139 -
140 -
141void QNetworkCacheMetaData::setLastModified(const QDateTime &dateTime) -
142{ -
143 d->lastModified = dateTime; -
144}
executed: }
Execution Count:44
44
145 -
146 -
147 -
148 -
149QDateTime QNetworkCacheMetaData::expirationDate() const -
150{ -
151 return d->expirationDate;
executed: return d->expirationDate;
Execution Count:120
120
152} -
153 -
154 -
155 -
156 -
157void QNetworkCacheMetaData::setExpirationDate(const QDateTime &dateTime) -
158{ -
159 d->expirationDate = dateTime; -
160}
executed: }
Execution Count:49
49
161QNetworkCacheMetaData::AttributesMap QNetworkCacheMetaData::attributes() const -
162{ -
163 return d->attributes;
executed: return d->attributes;
Execution Count:135
135
164} -
165void QNetworkCacheMetaData::setAttributes(const AttributesMap &attributes) -
166{ -
167 d->attributes = attributes; -
168}
executed: }
Execution Count:73
73
169QDataStream &operator<<(QDataStream &out, const QNetworkCacheMetaData &metaData) -
170{ -
171 QNetworkCacheMetaDataPrivate::save(out, metaData); -
172 return out;
executed: return out;
Execution Count:87
87
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) {
evaluated: it != begin
TRUEFALSE
yes
Evaluation Count:124
yes
Evaluation Count:87
87-124
181 --it; -
182 out << int(it.key()) << it.value(); -
183 }
executed: }
Execution Count:124
124
184 return out;
executed: return out;
Execution Count:87
87
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: }
Execution Count:87
87
198QDataStream &operator>>(QDataStream &in, QNetworkCacheMetaData &metaData) -
199{ -
200 QNetworkCacheMetaDataPrivate::load(in, metaData); -
201 return in;
executed: return in;
Execution Count:81
81
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) {
evaluated: i < n
TRUEFALSE
yes
Evaluation Count:126
yes
Evaluation Count:81
81-126
215 if (in.status() != QDataStream::Ok)
partially evaluated: in.status() != QDataStream::Ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:126
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: }
Execution Count:126
126
223 -
224 if (in.status() != QDataStream::Ok)
partially evaluated: in.status() != QDataStream::Ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:81
0-81
225 hash.clear();
never executed: hash.clear();
0
226 if (oldStatus != QDataStream::Ok)
partially evaluated: oldStatus != QDataStream::Ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:81
0-81
227 in.setStatus(oldStatus);
never executed: in.setStatus(oldStatus);
0
228 return in;
executed: return in;
Execution Count:81
81
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: }
Execution Count:81
81
240QAbstractNetworkCache::QAbstractNetworkCache(QObject *parent) -
241 : QObject(*new QAbstractNetworkCachePrivate, parent) -
242{ -
243}
executed: }
Execution Count:23
23
244 -
245 -
246 -
247 -
248QAbstractNetworkCache::QAbstractNetworkCache(QAbstractNetworkCachePrivate &dd, QObject *parent) -
249 : QObject(dd, parent) -
250{ -
251}
executed: }
Execution Count:61
61
252QAbstractNetworkCache::~QAbstractNetworkCache() -
253{ -
254} -
255 -
256 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial