Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/access/qabstractnetworkcache.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | - | |||||||
6 | class QNetworkCacheMetaDataPrivate : public QSharedData | - | ||||||
7 | { | - | ||||||
8 | - | |||||||
9 | public: | - | ||||||
10 | QNetworkCacheMetaDataPrivate() | - | ||||||
11 | : QSharedData() | - | ||||||
12 | , saveToDisk(true) | - | ||||||
13 | {} executed 708 times by 4 tests: end of block Executed by:
| 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:
| 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:
| 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:
| 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:
| 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:
| 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:
| 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 | }; | - | ||||||
35 | namespace { 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
executed 3 times by 3 tests: }guard.store(QtGlobalStatic::Destroyed); Executed by:
executed 3 times by 3 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of block Executed by:
executed 337 times by 4 tests: &holder.value;return &holder.value; Executed by:
executed 337 times by 4 tests: } } } static QGlobalStatic<QNetworkCacheMetaDataPrivate, Q_QGS_metadata_shared_invalid::innerFunction, Q_QGS_metadata_shared_invalid::guard> metadata_shared_invalid;return &holder.value; Executed by:
| 0-337 | ||||||
36 | QNetworkCacheMetaData::QNetworkCacheMetaData() | - | ||||||
37 | : d(new QNetworkCacheMetaDataPrivate) | - | ||||||
38 | { | - | ||||||
39 | } executed 704 times by 4 tests: end of block Executed by:
| 704 | ||||||
40 | - | |||||||
41 | - | |||||||
42 | - | |||||||
43 | - | |||||||
44 | QNetworkCacheMetaData::~QNetworkCacheMetaData() | - | ||||||
45 | { | - | ||||||
46 | - | |||||||
47 | } | - | ||||||
48 | - | |||||||
49 | - | |||||||
50 | - | |||||||
51 | - | |||||||
52 | QNetworkCacheMetaData::QNetworkCacheMetaData(const QNetworkCacheMetaData &other) | - | ||||||
53 | : d(other.d) | - | ||||||
54 | { | - | ||||||
55 | } executed 335 times by 4 tests: end of block Executed by:
| 335 | ||||||
56 | - | |||||||
57 | - | |||||||
58 | - | |||||||
59 | - | |||||||
60 | QNetworkCacheMetaData &QNetworkCacheMetaData::operator=(const QNetworkCacheMetaData &other) | - | ||||||
61 | { | - | ||||||
62 | d = other.d; | - | ||||||
63 | return executed 92 times by 4 tests: *this;return *this; Executed by:
executed 92 times by 4 tests: return *this; Executed by:
| 92 | ||||||
64 | } | - | ||||||
65 | bool QNetworkCacheMetaData::operator==(const QNetworkCacheMetaData &other) const | - | ||||||
66 | { | - | ||||||
67 | if (d == other.d
| 7-35 | ||||||
68 | return executed 7 times by 1 test: true;return true; Executed by:
executed 7 times by 1 test: return true; Executed by:
| 7 | ||||||
69 | if (d && other.d) | - | ||||||
70 | return executed 35 times by 4 tests: *d == *other.d;return *d == *other.d; Executed by:
executed 35 times by 4 tests: return *d == *other.d; Executed by:
| 35 | ||||||
71 | return never executed: false;return false; never executed: return false; | 0 | ||||||
72 | } | - | ||||||
73 | bool QNetworkCacheMetaData::isValid() const | - | ||||||
74 | { | - | ||||||
75 | return executed 337 times by 4 tests: !(*d == *metadata_shared_invalid());return !(*d == *metadata_shared_invalid()); Executed by:
executed 337 times by 4 tests: return !(*d == *metadata_shared_invalid()); Executed by:
| 337 | ||||||
76 | } | - | ||||||
77 | bool QNetworkCacheMetaData::saveToDisk() const | - | ||||||
78 | { | - | ||||||
79 | return executed 310 times by 4 tests: d->saveToDisk;return d->saveToDisk; Executed by:
executed 310 times by 4 tests: return d->saveToDisk; Executed by:
| 310 | ||||||
80 | } | - | ||||||
81 | - | |||||||
82 | - | |||||||
83 | - | |||||||
84 | - | |||||||
85 | - | |||||||
86 | - | |||||||
87 | - | |||||||
88 | void QNetworkCacheMetaData::setSaveToDisk(bool allow) | - | ||||||
89 | { | - | ||||||
90 | d->saveToDisk = allow; | - | ||||||
91 | } executed 79 times by 4 tests: end of block Executed by:
| 79 | ||||||
92 | - | |||||||
93 | - | |||||||
94 | - | |||||||
95 | - | |||||||
96 | - | |||||||
97 | - | |||||||
98 | QUrl QNetworkCacheMetaData::url() const | - | ||||||
99 | { | - | ||||||
100 | return executed 692 times by 4 tests: d->url;return d->url; Executed by:
executed 692 times by 4 tests: return d->url; Executed by:
| 692 | ||||||
101 | } | - | ||||||
102 | void 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:
| 120 | ||||||
108 | - | |||||||
109 | - | |||||||
110 | - | |||||||
111 | - | |||||||
112 | - | |||||||
113 | - | |||||||
114 | - | |||||||
115 | QNetworkCacheMetaData::RawHeaderList QNetworkCacheMetaData::rawHeaders() const | - | ||||||
116 | { | - | ||||||
117 | return executed 501 times by 4 tests: d->headers;return d->headers; Executed by:
executed 501 times by 4 tests: return d->headers; Executed by:
| 501 | ||||||
118 | } | - | ||||||
119 | - | |||||||
120 | - | |||||||
121 | - | |||||||
122 | - | |||||||
123 | - | |||||||
124 | - | |||||||
125 | void QNetworkCacheMetaData::setRawHeaders(const RawHeaderList &list) | - | ||||||
126 | { | - | ||||||
127 | d->headers = list; | - | ||||||
128 | } executed 98 times by 4 tests: end of block Executed by:
| 98 | ||||||
129 | - | |||||||
130 | - | |||||||
131 | - | |||||||
132 | - | |||||||
133 | QDateTime QNetworkCacheMetaData::lastModified() const | - | ||||||
134 | { | - | ||||||
135 | return executed 131 times by 4 tests: d->lastModified;return d->lastModified; Executed by:
executed 131 times by 4 tests: return d->lastModified; Executed by:
| 131 | ||||||
136 | } | - | ||||||
137 | - | |||||||
138 | - | |||||||
139 | - | |||||||
140 | - | |||||||
141 | void QNetworkCacheMetaData::setLastModified(const QDateTime &dateTime) | - | ||||||
142 | { | - | ||||||
143 | d->lastModified = dateTime; | - | ||||||
144 | } executed 43 times by 4 tests: end of block Executed by:
| 43 | ||||||
145 | - | |||||||
146 | - | |||||||
147 | - | |||||||
148 | - | |||||||
149 | QDateTime QNetworkCacheMetaData::expirationDate() const | - | ||||||
150 | { | - | ||||||
151 | return executed 125 times by 4 tests: d->expirationDate;return d->expirationDate; Executed by:
executed 125 times by 4 tests: return d->expirationDate; Executed by:
| 125 | ||||||
152 | } | - | ||||||
153 | - | |||||||
154 | - | |||||||
155 | - | |||||||
156 | - | |||||||
157 | void QNetworkCacheMetaData::setExpirationDate(const QDateTime &dateTime) | - | ||||||
158 | { | - | ||||||
159 | d->expirationDate = dateTime; | - | ||||||
160 | } executed 49 times by 4 tests: end of block Executed by:
| 49 | ||||||
161 | QNetworkCacheMetaData::AttributesMap QNetworkCacheMetaData::attributes() const | - | ||||||
162 | { | - | ||||||
163 | return executed 139 times by 4 tests: d->attributes;return d->attributes; Executed by:
executed 139 times by 4 tests: return d->attributes; Executed by:
| 139 | ||||||
164 | } | - | ||||||
165 | void QNetworkCacheMetaData::setAttributes(const AttributesMap &attributes) | - | ||||||
166 | { | - | ||||||
167 | d->attributes = attributes; | - | ||||||
168 | } executed 70 times by 3 tests: end of block Executed by:
| 70 | ||||||
169 | QDataStream &operator<<(QDataStream &out, const QNetworkCacheMetaData &metaData) | - | ||||||
170 | { | - | ||||||
171 | QNetworkCacheMetaDataPrivate::save(out, metaData); | - | ||||||
172 | return executed 91 times by 4 tests: out;return out; Executed by:
executed 91 times by 4 tests: return out; Executed by:
| 91 | ||||||
173 | } | - | ||||||
174 | - | |||||||
175 | static 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
| 91-118 | ||||||
181 | --it; | - | ||||||
182 | out << int(it.key()) << it.value(); | - | ||||||
183 | } executed 118 times by 3 tests: end of block Executed by:
| 118 | ||||||
184 | return executed 91 times by 4 tests: out;return out; Executed by:
executed 91 times by 4 tests: return out; Executed by:
| 91 | ||||||
185 | } | - | ||||||
186 | - | |||||||
187 | void 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:
| 91 | ||||||
198 | QDataStream &operator>>(QDataStream &in, QNetworkCacheMetaData &metaData) | - | ||||||
199 | { | - | ||||||
200 | QNetworkCacheMetaDataPrivate::load(in, metaData); | - | ||||||
201 | return executed 86 times by 4 tests: in;return in; Executed by:
executed 86 times by 4 tests: return in; Executed by:
| 86 | ||||||
202 | } | - | ||||||
203 | - | |||||||
204 | static 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
| 86-126 | ||||||
215 | if (in.status() != QDataStream::Ok
| 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:
| 126 | ||||||
223 | - | |||||||
224 | if (in.status() != QDataStream::Ok
| 0-86 | ||||||
225 | hash.clear(); never executed: hash.clear(); | 0 | ||||||
226 | if (oldStatus != QDataStream::Ok
| 0-86 | ||||||
227 | in.setStatus(oldStatus); never executed: in.setStatus(oldStatus); | 0 | ||||||
228 | return executed 86 times by 4 tests: in;return in; Executed by:
executed 86 times by 4 tests: return in; Executed by:
| 86 | ||||||
229 | } | - | ||||||
230 | - | |||||||
231 | void 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:
| 86 | ||||||
240 | QAbstractNetworkCache::QAbstractNetworkCache(QObject *parent) | - | ||||||
241 | : QObject(*new QAbstractNetworkCachePrivate, parent) | - | ||||||
242 | { | - | ||||||
243 | } executed 23 times by 1 test: end of block Executed by:
| 23 | ||||||
244 | - | |||||||
245 | - | |||||||
246 | - | |||||||
247 | - | |||||||
248 | QAbstractNetworkCache::QAbstractNetworkCache(QAbstractNetworkCachePrivate &dd, QObject *parent) | - | ||||||
249 | : QObject(dd, parent) | - | ||||||
250 | { | - | ||||||
251 | } executed 66 times by 3 tests: end of block Executed by:
| 66 | ||||||
252 | QAbstractNetworkCache::~QAbstractNetworkCache() | - | ||||||
253 | { | - | ||||||
254 | } | - | ||||||
255 | - | |||||||
Switch to Source code | Preprocessed file |