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

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