qurlquery.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qurlquery.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6typedef QList<QPair<QString, QString> > Map;-
7-
8class QUrlQueryPrivate : public QSharedData-
9{-
10public:-
11 QUrlQueryPrivate(const QString &query = QString())-
12 : valueDelimiter(QUrlQuery::defaultQueryValueDelimiter()),-
13 pairDelimiter(QUrlQuery::defaultQueryPairDelimiter())-
14 { if (!query.isEmpty()
!query.isEmpty()Description
TRUEevaluated 53 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 55 times by 1 test
Evaluated by:
  • tst_QUrlQuery
) setQuery(query);
executed 53 times by 2 tests: setQuery(query);
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
}
executed 108 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
53-108
15-
16 QString recodeFromUser(const QString &input) const;-
17 QString recodeToUser(const QString &input, QUrl::ComponentFormattingOptions encoding) const;-
18-
19 void setQuery(const QString &query);-
20-
21 void addQueryItem(const QString &key, const QString &value)-
22 { itemList.append(qMakePair(recodeFromUser(key), recodeFromUser(value))); }
executed 104 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
104
23 int findRecodedKey(const QString &key, int from = 0) const-
24 {-
25 for (int i = from; i < itemList.size()
i < itemList.size()Description
TRUEevaluated 103 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 17 times by 1 test
Evaluated by:
  • tst_QUrlQuery
; ++i)
17-103
26 if (itemList.at(i).first == key
itemList.at(i).first == keyDescription
TRUEevaluated 59 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
44-59
27 return
executed 59 times by 2 tests: return i;
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
i;
executed 59 times by 2 tests: return i;
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
59
28 return
executed 17 times by 1 test: return itemList.size();
Executed by:
  • tst_QUrlQuery
itemList.size();
executed 17 times by 1 test: return itemList.size();
Executed by:
  • tst_QUrlQuery
17
29 }-
30 Map::const_iterator findKey(const QString &key) const-
31 { return
executed 39 times by 2 tests: return itemList.constBegin() + findRecodedKey(recodeFromUser(key));
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
itemList.constBegin() + findRecodedKey(recodeFromUser(key));
executed 39 times by 2 tests: return itemList.constBegin() + findRecodedKey(recodeFromUser(key));
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
}
39
32 Map::iterator findKey(const QString &key)-
33 { return
executed 6 times by 1 test: return itemList.begin() + findRecodedKey(recodeFromUser(key));
Executed by:
  • tst_QUrlQuery
itemList.begin() + findRecodedKey(recodeFromUser(key));
executed 6 times by 1 test: return itemList.begin() + findRecodedKey(recodeFromUser(key));
Executed by:
  • tst_QUrlQuery
}
6
34-
35 Map itemList;-
36 QChar valueDelimiter;-
37 QChar pairDelimiter;-
38};-
39-
40template<> void QSharedDataPointer<QUrlQueryPrivate>::detach()-
41{-
42 if (d
dDescription
TRUEevaluated 88 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 55 times by 1 test
Evaluated by:
  • tst_QUrlQuery
&& d->ref.load() == 1
d->ref.load() == 1Description
TRUEevaluated 84 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
4-88
43 return;
executed 84 times by 1 test: return;
Executed by:
  • tst_QUrlQuery
84
44 QUrlQueryPrivate *x = (d
dDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 55 times by 1 test
Evaluated by:
  • tst_QUrlQuery
? new QUrlQueryPrivate(*d)
4-55
45 : new QUrlQueryPrivate);-
46 x->ref.ref();-
47 if (d
dDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 55 times by 1 test
Evaluated by:
  • tst_QUrlQuery
&& !d->ref.deref()
!d->ref.deref()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
0-55
48 delete d;
never executed: delete d;
0
49 d = x;-
50}
executed 59 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
59
51inline QString QUrlQueryPrivate::recodeFromUser(const QString &input) const-
52{-
53-
54 QString output;-
55 ushort prettyDecodedActions[] = {-
56 ushort(pairDelimiter.unicode()),-
57 ushort(valueDelimiter.unicode()),-
58 ushort('#'),-
59 0-
60 };-
61 if (qt_urlRecode(output, input.constData(), input.constData() + input.length(),
qt_urlRecode(o...ecodedActions)Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 242 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
26-242
62 QUrl::DecodeReserved,
qt_urlRecode(o...ecodedActions)Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 242 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
26-242
63 prettyDecodedActions)
qt_urlRecode(o...ecodedActions)Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 242 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
)
26-242
64 return
executed 26 times by 1 test: return output;
Executed by:
  • tst_QUrlQuery
output;
executed 26 times by 1 test: return output;
Executed by:
  • tst_QUrlQuery
26
65 return
executed 242 times by 2 tests: return input;
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
input;
executed 242 times by 2 tests: return input;
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
242
66}-
67-
68inline bool idempotentRecodeToUser(QUrl::ComponentFormattingOptions encoding)-
69{-
70 return
executed 153 times by 2 tests: return encoding == QUrl::PrettyDecoded;
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
encoding == QUrl::PrettyDecoded;
executed 153 times by 2 tests: return encoding == QUrl::PrettyDecoded;
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
153
71}-
72-
73inline QString QUrlQueryPrivate::recodeToUser(const QString &input, QUrl::ComponentFormattingOptions encoding) const-
74{-
75-
76-
77 if (idempotentRecodeToUser(encoding)
idempotentReco...User(encoding)Description
TRUEevaluated 42 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
24-42
78 return
executed 42 times by 2 tests: return input;
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
input;
executed 42 times by 2 tests: return input;
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
42
79-
80 if (!(encoding & QUrl::EncodeDelimiters)
!(encoding & Q...odeDelimiters)Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_QUrlQuery
) {
8-16
81 QString output;-
82 if (qt_urlRecode(output, input.constData(), input.constData() + input.length(),
qt_urlRecode(o..., encoding, 0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrlQuery
4
83 encoding, 0)
qt_urlRecode(o..., encoding, 0)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
4
84 return
executed 4 times by 1 test: return output;
Executed by:
  • tst_QUrlQuery
output;
executed 4 times by 1 test: return output;
Executed by:
  • tst_QUrlQuery
4
85 return
executed 4 times by 1 test: return input;
Executed by:
  • tst_QUrlQuery
input;
executed 4 times by 1 test: return input;
Executed by:
  • tst_QUrlQuery
4
86 }-
87-
88-
89 ushort actions[] = { ushort(0x200 | (pairDelimiter.unicode())), ushort(0x200 | (valueDelimiter.unicode())),-
90 ushort(0x200 | ('#')), 0 };-
91 QString output;-
92 if (qt_urlRecode(output, input.constData(), input.constData() + input.length(), encoding, actions)
qt_urlRecode(o...ding, actions)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
6-10
93 return
executed 6 times by 1 test: return output;
Executed by:
  • tst_QUrlQuery
output;
executed 6 times by 1 test: return output;
Executed by:
  • tst_QUrlQuery
6
94 return
executed 10 times by 1 test: return input;
Executed by:
  • tst_QUrlQuery
input;
executed 10 times by 1 test: return input;
Executed by:
  • tst_QUrlQuery
10
95}-
96-
97void QUrlQueryPrivate::setQuery(const QString &query)-
98{-
99 ushort prettyDecodedActions[] = {-
100 ushort(pairDelimiter.unicode()),-
101 ushort(valueDelimiter.unicode()),-
102 ushort('#'),-
103 0-
104 };-
105-
106 itemList.clear();-
107 const QChar *pos = query.constData();-
108 const QChar *const end = pos + query.size();-
109 while (pos != end
pos != endDescription
TRUEevaluated 79 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 56 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
) {
56-79
110 const QChar *begin = pos;-
111 const QChar *delimiter = 0;-
112 while (pos != end
pos != endDescription
TRUEevaluated 572 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 55 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
) {
55-572
113-
114 if (!delimiter
!delimiterDescription
TRUEevaluated 344 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 228 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
&& pos->unicode() == valueDelimiter
pos->unicode()...valueDelimiterDescription
TRUEevaluated 69 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 275 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
)
69-344
115 delimiter = pos;
executed 69 times by 2 tests: delimiter = pos;
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
69
116 if (pos->unicode() == pairDelimiter
pos->unicode()... pairDelimiterDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 548 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
)
24-548
117 break;
executed 24 times by 1 test: break;
Executed by:
  • tst_QUrlQuery
24
118 ++pos;-
119 }
executed 548 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
548
120 if (!delimiter
!delimiterDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 69 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
)
10-69
121 delimiter = pos;
executed 10 times by 1 test: delimiter = pos;
Executed by:
  • tst_QUrlQuery
10
122-
123-
124-
125-
126 QString key;-
127 if (!qt_urlRecode(key, begin, delimiter,
!qt_urlRecode(...ecodedActions)Description
TRUEevaluated 67 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUrlQuery
12-67
128 QUrl::DecodeReserved,
!qt_urlRecode(...ecodedActions)Description
TRUEevaluated 67 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUrlQuery
12-67
129 prettyDecodedActions)
!qt_urlRecode(...ecodedActions)Description
TRUEevaluated 67 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
12-67
130 key = QString(begin, delimiter - begin);
executed 67 times by 2 tests: key = QString(begin, delimiter - begin);
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
67
131-
132 if (delimiter == pos
delimiter == posDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 69 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
) {
10-69
133-
134 itemList.append(qMakePair(key, QString()));-
135 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
else if (delimiter + 1 == pos
delimiter + 1 == posDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 64 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
) {
5-64
136-
137 itemList.append(qMakePair(key, QString(0, Qt::Uninitialized)));-
138 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
else {
5
139 QString value;-
140 if (!qt_urlRecode(value, delimiter + 1, pos,
!qt_urlRecode(...ecodedActions)Description
TRUEevaluated 52 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUrlQuery
12-52
141 QUrl::DecodeReserved,
!qt_urlRecode(...ecodedActions)Description
TRUEevaluated 52 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUrlQuery
12-52
142 prettyDecodedActions)
!qt_urlRecode(...ecodedActions)Description
TRUEevaluated 52 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
12-52
143 value = QString(delimiter + 1, pos - delimiter - 1);
executed 52 times by 2 tests: value = QString(delimiter + 1, pos - delimiter - 1);
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
52
144 itemList.append(qMakePair(key, value));-
145 }
executed 64 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
64
146-
147 if (pos != end
pos != endDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 55 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
)
24-55
148 ++
executed 24 times by 1 test: ++pos;
Executed by:
  • tst_QUrlQuery
pos;
executed 24 times by 1 test: ++pos;
Executed by:
  • tst_QUrlQuery
24
149 }
executed 79 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
79
150}
executed 56 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
56
151-
152-
153template <> inline QUrlQueryPrivate *-
154QSharedDataPointer<QUrlQueryPrivate>::clone()-
155{-
156 return
never executed: return d ? new QUrlQueryPrivate(*d) : new QUrlQueryPrivate;
d ? new QUrlQueryPrivate(*d) : new QUrlQueryPrivate;
never executed: return d ? new QUrlQueryPrivate(*d) : new QUrlQueryPrivate;
0
157}-
158-
159-
160-
161-
162-
163-
164-
165QUrlQuery::QUrlQuery()-
166 : d(0)-
167{-
168}
executed 60 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
60
169-
170-
171-
172-
173-
174-
175-
176QUrlQuery::QUrlQuery(const QString &queryString)-
177 : d(queryString.isEmpty() ? 0 : new QUrlQueryPrivate(queryString))-
178{-
179}
executed 49 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
49
180QUrlQuery::QUrlQuery(const QUrl &url)-
181 : d(0)-
182{-
183-
184-
185 if (url.hasQuery()
url.hasQuery()Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QNetworkReply
FALSEnever evaluated
)
0-7
186 d = new QUrlQueryPrivate(url.query());
executed 7 times by 1 test: d = new QUrlQueryPrivate(url.query());
Executed by:
  • tst_QNetworkReply
7
187}
executed 7 times by 1 test: end of block
Executed by:
  • tst_QNetworkReply
7
188-
189-
190-
191-
192-
193QUrlQuery::QUrlQuery(const QUrlQuery &other)-
194 : d(other.d)-
195{-
196}
executed 5 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
5
197-
198-
199-
200-
201-
202QUrlQuery &QUrlQuery::operator =(const QUrlQuery &other)-
203{-
204 d = other.d;-
205 return
executed 2 times by 1 test: return *this;
Executed by:
  • tst_QUrlQuery
*this;
executed 2 times by 1 test: return *this;
Executed by:
  • tst_QUrlQuery
2
206}-
207QUrlQuery::~QUrlQuery()-
208{-
209-
210}-
211-
212-
213-
214-
215-
216bool QUrlQuery::operator ==(const QUrlQuery &other) const-
217{-
218 if (d == other.d
d == other.dDescription
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
7-10
219 return
executed 7 times by 1 test: return true;
Executed by:
  • tst_QUrlQuery
true;
executed 7 times by 1 test: return true;
Executed by:
  • tst_QUrlQuery
7
220 if (d && other.d)-
221-
222 return
executed 8 times by 1 test: return d->valueDelimiter == other.d->valueDelimiter && d->pairDelimiter == other.d->pairDelimiter && d->itemList == other.d->itemList;
Executed by:
  • tst_QUrlQuery
d->valueDelimiter == other.d->valueDelimiter &&
executed 8 times by 1 test: return d->valueDelimiter == other.d->valueDelimiter && d->pairDelimiter == other.d->pairDelimiter && d->itemList == other.d->itemList;
Executed by:
  • tst_QUrlQuery
8
223 d->pairDelimiter == other.d->pairDelimiter &&
executed 8 times by 1 test: return d->valueDelimiter == other.d->valueDelimiter && d->pairDelimiter == other.d->pairDelimiter && d->itemList == other.d->itemList;
Executed by:
  • tst_QUrlQuery
8
224 d->itemList == other.d->itemList;
executed 8 times by 1 test: return d->valueDelimiter == other.d->valueDelimiter && d->pairDelimiter == other.d->pairDelimiter && d->itemList == other.d->itemList;
Executed by:
  • tst_QUrlQuery
8
225 return
executed 2 times by 1 test: return false;
Executed by:
  • tst_QUrlQuery
false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_QUrlQuery
2
226}-
227uint qHash(const QUrlQuery &key, uint seed) noexcept-
228{-
229 if (const
const QUrlQuer...ate *d = key.dDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrlQuery
QUrlQueryPrivate *d = key.d
const QUrlQuer...ate *d = key.dDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrlQuery
) {
2-4
230 QtPrivate::QHashCombine hash;-
231-
232 seed = hash(seed, d->valueDelimiter);-
233 seed = hash(seed, d->pairDelimiter);-
234 seed = hash(seed, d->itemList);-
235 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
2
236 return
executed 6 times by 1 test: return seed;
Executed by:
  • tst_QUrlQuery
seed;
executed 6 times by 1 test: return seed;
Executed by:
  • tst_QUrlQuery
6
237}-
238-
239-
240-
241-
242-
243-
244-
245bool QUrlQuery::isEmpty() const-
246{-
247 return
executed 37 times by 1 test: return d ? d->itemList.isEmpty() : true;
Executed by:
  • tst_QUrlQuery
d ? d->itemList.isEmpty() : true;
executed 37 times by 1 test: return d ? d->itemList.isEmpty() : true;
Executed by:
  • tst_QUrlQuery
37
248}-
249-
250-
251-
252-
253bool QUrlQuery::isDetached() const-
254{-
255 return
executed 4 times by 1 test: return d && d->ref.load() == 1;
Executed by:
  • tst_QUrlQuery
d && d->ref.load() == 1;
executed 4 times by 1 test: return d && d->ref.load() == 1;
Executed by:
  • tst_QUrlQuery
4
256}-
257void QUrlQuery::clear()-
258{-
259 if (d.constData()
d.constData()Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
5-16
260 d->itemList.clear();
executed 16 times by 1 test: d->itemList.clear();
Executed by:
  • tst_QUrlQuery
16
261}
executed 21 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
21
262-
263-
264-
265-
266-
267-
268-
269void QUrlQuery::setQuery(const QString &queryString)-
270{-
271 d->setQuery(queryString);-
272}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
3
273-
274static void recodeAndAppend(QString &to, const QString &input,-
275 QUrl::ComponentFormattingOptions encoding, const ushort *tableModifications)-
276{-
277 if (!qt_urlRecode(to, input.constData(), input.constData() + input.length(), encoding, tableModifications)
!qt_urlRecode(...Modifications)Description
TRUEevaluated 123 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
32-123
278 to += input;
executed 123 times by 1 test: to += input;
Executed by:
  • tst_QUrlQuery
123
279}
executed 155 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
155
280QString QUrlQuery::query(QUrl::ComponentFormattingOptions encoding) const-
281{-
282 if (!d
!dDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 66 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
2-66
283 return
executed 2 times by 1 test: return QString();
Executed by:
  • tst_QUrlQuery
QString();
executed 2 times by 1 test: return QString();
Executed by:
  • tst_QUrlQuery
2
284-
285-
286-
287-
288-
289-
290 ushort tableActions[] = {-
291 ushort(0x200 | (d->pairDelimiter.unicode())),-
292 ushort(0x200 | (d->valueDelimiter.unicode())),-
293 0,-
294 0-
295 };-
296 if (encoding & QUrl::EncodeDelimiters
encoding & QUr...codeDelimitersDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 60 times by 1 test
Evaluated by:
  • tst_QUrlQuery
) {
6-60
297 tableActions[2] = ushort(0x200 | ('#'));-
298 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
6
299-
300 QString result;-
301 Map::const_iterator it = d->itemList.constBegin();-
302 Map::const_iterator end = d->itemList.constEnd();-
303-
304 {-
305 int size = 0;-
306 for ( ; it != end
it != endDescription
TRUEevaluated 81 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 66 times by 1 test
Evaluated by:
  • tst_QUrlQuery
; ++it)
66-81
307 size += it->first.length() + 1 + it->second.length() + 1;
executed 81 times by 1 test: size += it->first.length() + 1 + it->second.length() + 1;
Executed by:
  • tst_QUrlQuery
81
308 result.reserve(size + size / 4);-
309 }-
310-
311 for (it = d->itemList.constBegin(); it != end
it != endDescription
TRUEevaluated 81 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 66 times by 1 test
Evaluated by:
  • tst_QUrlQuery
; ++it) {
66-81
312 if (!result.isEmpty()
!result.isEmpty()Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 66 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
15-66
313 result += QChar(d->pairDelimiter);
executed 15 times by 1 test: result += QChar(d->pairDelimiter);
Executed by:
  • tst_QUrlQuery
15
314 recodeAndAppend(result, it->first, encoding, tableActions);-
315 if (!it->second.isNull()
!it->second.isNull()Description
TRUEevaluated 74 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrlQuery
) {
7-74
316 result += QChar(d->valueDelimiter);-
317 recodeAndAppend(result, it->second, encoding, tableActions);-
318 }
executed 74 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
74
319 }
executed 81 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
81
320 return
executed 66 times by 1 test: return result;
Executed by:
  • tst_QUrlQuery
result;
executed 66 times by 1 test: return result;
Executed by:
  • tst_QUrlQuery
66
321}-
322void QUrlQuery::setQueryDelimiters(QChar valueDelimiter, QChar pairDelimiter)-
323{-
324 d->valueDelimiter = valueDelimiter.unicode();-
325 d->pairDelimiter = pairDelimiter.unicode();-
326}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
3
327-
328-
329-
330-
331-
332-
333-
334QChar QUrlQuery::queryValueDelimiter() const-
335{-
336 return
executed 2 times by 1 test: return d ? d->valueDelimiter : defaultQueryValueDelimiter();
Executed by:
  • tst_QUrlQuery
d ? d->valueDelimiter : defaultQueryValueDelimiter();
executed 2 times by 1 test: return d ? d->valueDelimiter : defaultQueryValueDelimiter();
Executed by:
  • tst_QUrlQuery
2
337}-
338-
339-
340-
341-
342-
343-
344-
345QChar QUrlQuery::queryPairDelimiter() const-
346{-
347 return
executed 2 times by 1 test: return d ? d->pairDelimiter : defaultQueryPairDelimiter();
Executed by:
  • tst_QUrlQuery
d ? d->pairDelimiter : defaultQueryPairDelimiter();
executed 2 times by 1 test: return d ? d->pairDelimiter : defaultQueryPairDelimiter();
Executed by:
  • tst_QUrlQuery
2
348}-
349void QUrlQuery::setQueryItems(const QList<QPair<QString, QString> > &query)-
350{-
351 clear();-
352 if (query.isEmpty()
query.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
1-9
353 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QUrlQuery
1
354-
355 QUrlQueryPrivate *dd = d;-
356 QList<QPair<QString, QString> >::const_iterator it = query.constBegin(),-
357 end = query.constEnd();-
358 for ( ; it != end
it != endDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QUrlQuery
; ++it)
9-24
359 dd->addQueryItem(it->first, it->second);
executed 24 times by 1 test: dd->addQueryItem(it->first, it->second);
Executed by:
  • tst_QUrlQuery
24
360}
executed 9 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
9
361QList<QPair<QString, QString> > QUrlQuery::queryItems(QUrl::ComponentFormattingOptions encoding) const-
362{-
363 if (!d
!dDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 87 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
5-87
364 return
executed 5 times by 1 test: return QList<QPair<QString, QString> >();
Executed by:
  • tst_QUrlQuery
QList<QPair<QString, QString> >();
executed 5 times by 1 test: return QList<QPair<QString, QString> >();
Executed by:
  • tst_QUrlQuery
5
365 if (idempotentRecodeToUser(encoding)
idempotentReco...User(encoding)Description
TRUEevaluated 76 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
11-76
366 return
executed 76 times by 1 test: return d->itemList;
Executed by:
  • tst_QUrlQuery
d->itemList;
executed 76 times by 1 test: return d->itemList;
Executed by:
  • tst_QUrlQuery
76
367-
368 QList<QPair<QString, QString> > result;-
369 Map::const_iterator it = d->itemList.constBegin();-
370 Map::const_iterator end = d->itemList.constEnd();-
371 result.reserve(d->itemList.count());-
372 for ( ; it != end
it != endDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 11 times by 1 test
Evaluated by:
  • tst_QUrlQuery
; ++it)
11-12
373 result << qMakePair(d->recodeToUser(it->first, encoding),
executed 12 times by 1 test: result << qMakePair(d->recodeToUser(it->first, encoding), d->recodeToUser(it->second, encoding));
Executed by:
  • tst_QUrlQuery
12
374 d->recodeToUser(it->second, encoding));
executed 12 times by 1 test: result << qMakePair(d->recodeToUser(it->first, encoding), d->recodeToUser(it->second, encoding));
Executed by:
  • tst_QUrlQuery
12
375 return
executed 11 times by 1 test: return result;
Executed by:
  • tst_QUrlQuery
result;
executed 11 times by 1 test: return result;
Executed by:
  • tst_QUrlQuery
11
376}-
377-
378-
379-
380-
381-
382-
383-
384bool QUrlQuery::hasQueryItem(const QString &key) const-
385{-
386 if (!d
!dDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_QUrlQuery
)
4-16
387 return
executed 4 times by 1 test: return false;
Executed by:
  • tst_QUrlQuery
false;
executed 4 times by 1 test: return false;
Executed by:
  • tst_QUrlQuery
4
388 return
executed 16 times by 1 test: return d->findKey(key) != d->itemList.constEnd();
Executed by:
  • tst_QUrlQuery
d->findKey(key) != d->itemList.constEnd();
executed 16 times by 1 test: return d->findKey(key) != d->itemList.constEnd();
Executed by:
  • tst_QUrlQuery
16
389}-
390void QUrlQuery::addQueryItem(const QString &key, const QString &value)-
391{-
392 d->addQueryItem(key, value);-
393}
executed 80 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
80
394QString QUrlQuery::queryItemValue(const QString &key, QUrl::ComponentFormattingOptions encoding) const-
395{-
396 QString result;-
397 if (d
dDescription
TRUEevaluated 23 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrlQuery
) {
3-23
398 Map::const_iterator it = d->findKey(key);-
399 if (it != d->itemList.constEnd()
it != d->itemList.constEnd()Description
TRUEevaluated 23 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrlQuery
FALSEnever evaluated
)
0-23
400 result = d->recodeToUser(it->second, encoding);
executed 23 times by 2 tests: result = d->recodeToUser(it->second, encoding);
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
23
401 }
executed 23 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
23
402 return
executed 26 times by 2 tests: return result;
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
result;
executed 26 times by 2 tests: return result;
Executed by:
  • tst_QNetworkReply
  • tst_QUrlQuery
26
403}-
404QStringList QUrlQuery::allQueryItemValues(const QString &key, QUrl::ComponentFormattingOptions encoding) const-
405{-
406 QStringList result;-
407 if (d
dDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrlQuery
) {
3-12
408 QString encodedKey = d->recodeFromUser(key);-
409 int idx = d->findRecodedKey(encodedKey);-
410 while (idx < d->itemList.size()
idx < d->itemList.size()Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QUrlQuery
) {
12-19
411 result << d->recodeToUser(d->itemList.at(idx).second, encoding);-
412 idx = d->findRecodedKey(encodedKey, idx + 1);-
413 }
executed 19 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
19
414 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
12
415 return
executed 15 times by 1 test: return result;
Executed by:
  • tst_QUrlQuery
result;
executed 15 times by 1 test: return result;
Executed by:
  • tst_QUrlQuery
15
416}-
417void QUrlQuery::removeQueryItem(const QString &key)-
418{-
419 if (d.constData()
d.constData()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEnever evaluated
) {
0-6
420 Map::iterator it = d->findKey(key);-
421 if (it != d->itemList.end()
it != d->itemList.end()Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrlQuery
)
1-5
422 d->itemList.erase(it);
executed 5 times by 1 test: d->itemList.erase(it);
Executed by:
  • tst_QUrlQuery
5
423 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
6
424}
executed 6 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
6
425-
426-
427-
428-
429-
430-
431-
432void QUrlQuery::removeAllQueryItems(const QString &key)-
433{-
434 if (d.constData()
d.constData()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrlQuery
FALSEnever evaluated
) {
0-3
435 const QString encodedKey = d->recodeFromUser(key);-
436 auto firstEqualsEncodedKey = [&encodedKey](const QPair<QString, QString> &item) {-
437 return
executed 14 times by 1 test: return item.first == encodedKey;
Executed by:
  • tst_QUrlQuery
item.first == encodedKey;
executed 14 times by 1 test: return item.first == encodedKey;
Executed by:
  • tst_QUrlQuery
14
438 };-
439 const auto end = d->itemList.end();-
440 d->itemList.erase(std::remove_if(d->itemList.begin(), end, firstEqualsEncodedKey), end);-
441 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
3
442}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QUrlQuery
3
443-
Switch to Source codePreprocessed file

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