qurl.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qurl.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6extern QString qt_normalizePathSegments(const QString &name, bool allowUncPaths);-
7-
8inline static bool isHex(char c)-
9{-
10 c |= 0x20;-
11 return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');-
12}-
13-
14static inline QString ftpScheme()-
15{-
16 return ([]() -> QString { enum { Size = sizeof(u"" "ftp")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "ftp" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());-
17}-
18-
19static inline QString fileScheme()-
20{-
21 return ([]() -> QString { enum { Size = sizeof(u"" "file")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "file" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());-
22}-
23-
24static inline QString webDavScheme()-
25{-
26 return ([]() -> QString { enum { Size = sizeof(u"" "webdavs")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "webdavs" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());-
27}-
28-
29static inline QString webDavSslTag()-
30{-
31 return ([]() -> QString { enum { Size = sizeof(u"" "@SSL")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "@SSL" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());-
32}-
33-
34-
35-
36-
37-
38-
39-
40class QUrlPrivate-
41{-
42public:-
43 enum Section : uchar {-
44 Scheme = 0x01,-
45 UserName = 0x02,-
46 Password = 0x04,-
47 UserInfo = UserName | Password,-
48 Host = 0x08,-
49 Port = 0x10,-
50 Authority = UserInfo | Host | Port,-
51 Path = 0x20,-
52 Hierarchy = Authority | Path,-
53 Query = 0x40,-
54 Fragment = 0x80,-
55 FullUrl = 0xff-
56 };-
57-
58 enum Flags : uchar {-
59 IsLocalFile = 0x01-
60 };-
61-
62 enum ErrorCode {-
63-
64-
65 InvalidSchemeError = Scheme << 8,-
66-
67 InvalidUserNameError = UserName << 8,-
68-
69 InvalidPasswordError = Password << 8,-
70-
71 InvalidRegNameError = Host << 8,-
72 InvalidIPv4AddressError,-
73 InvalidIPv6AddressError,-
74 InvalidCharacterInIPv6Error,-
75 InvalidIPvFutureError,-
76 HostMissingEndBracket,-
77-
78 InvalidPortError = Port << 8,-
79 PortEmptyError,-
80-
81 InvalidPathError = Path << 8,-
82-
83 InvalidQueryError = Query << 8,-
84-
85 InvalidFragmentError = Fragment << 8,-
86-
87-
88-
89 AuthorityPresentAndPathIsRelative = Authority << 8 | Path << 8 | 0x10000,-
90 RelativeUrlPathContainsColonBeforeSlash = Scheme << 8 | Authority << 8 | Path << 8 | 0x10000,-
91-
92 NoError = 0-
93 };-
94-
95 struct Error {-
96 QString source;-
97 ErrorCode code;-
98 int position;-
99 };-
100-
101 QUrlPrivate();-
102 QUrlPrivate(const QUrlPrivate &copy);-
103 ~QUrlPrivate();-
104-
105 void parse(const QString &url, QUrl::ParsingMode parsingMode);-
106 bool isEmpty() const-
107 { return sectionIsPresent == 0 && port == -1 && path.isEmpty(); }-
108-
109 Error *cloneError() const;-
110 void clearError();-
111 void setError(ErrorCode errorCode, const QString &source, int supplement = -1);-
112 ErrorCode validityError(QString *source = 0, int *position = 0) const;-
113 bool validateComponent(Section section, const QString &input, int begin, int end);-
114 bool validateComponent(Section section, const QString &input)-
115 { return validateComponent(section, input, 0, uint(input.length())); }-
116-
117-
118 void appendAuthority(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;-
119 void appendUserInfo(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;-
120 void appendUserName(QString &appendTo, QUrl::FormattingOptions options) const;-
121 void appendPassword(QString &appendTo, QUrl::FormattingOptions options) const;-
122 void appendHost(QString &appendTo, QUrl::FormattingOptions options) const;-
123 void appendPath(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;-
124 void appendQuery(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;-
125 void appendFragment(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const;-
126-
127-
128 bool setScheme(const QString &value, int len, bool doSetError);-
129 void setAuthority(const QString &auth, int from, int end, QUrl::ParsingMode mode);-
130 void setUserInfo(const QString &userInfo, int from, int end);-
131 void setUserName(const QString &value, int from, int end);-
132 void setPassword(const QString &value, int from, int end);-
133 bool setHost(const QString &value, int from, int end, QUrl::ParsingMode mode);-
134 void setPath(const QString &value, int from, int end);-
135 void setQuery(const QString &value, int from, int end);-
136 void setFragment(const QString &value, int from, int end);-
137-
138 inline bool hasScheme() const { return sectionIsPresent & Scheme; }-
139 inline bool hasAuthority() const { return sectionIsPresent & Authority; }-
140 inline bool hasUserInfo() const { return sectionIsPresent & UserInfo; }-
141 inline bool hasUserName() const { return sectionIsPresent & UserName; }-
142 inline bool hasPassword() const { return sectionIsPresent & Password; }-
143 inline bool hasHost() const { return sectionIsPresent & Host; }-
144 inline bool hasPort() const { return port != -1; }-
145 inline bool hasPath() const { return !path.isEmpty(); }-
146 inline bool hasQuery() const { return sectionIsPresent & Query; }-
147 inline bool hasFragment() const { return sectionIsPresent & Fragment; }-
148-
149 inline bool isLocalFile() const { return flags & IsLocalFile; }-
150 QString toLocalFile(QUrl::FormattingOptions options) const;-
151-
152 QString mergePaths(const QString &relativePath) const;-
153-
154 QAtomicInt ref;-
155 int port;-
156-
157 QString scheme;-
158 QString userName;-
159 QString password;-
160 QString host;-
161 QString path;-
162 QString query;-
163 QString fragment;-
164-
165 Error *error;-
166-
167-
168-
169-
170-
171 uchar sectionIsPresent;-
172 uchar flags;-
173-
174-
175-
176};-
177-
178-
179inline QUrlPrivate::QUrlPrivate()-
180 : ref(1), port(-1),-
181 error(0),-
182 sectionIsPresent(0),-
183 flags(0)-
184{-
185}-
186-
187inline QUrlPrivate::QUrlPrivate(const QUrlPrivate &copy)-
188 : ref(1), port(copy.port),-
189 scheme(copy.scheme),-
190 userName(copy.userName),-
191 password(copy.password),-
192 host(copy.host),-
193 path(copy.path),-
194 query(copy.query),-
195 fragment(copy.fragment),-
196 error(copy.cloneError()),-
197 sectionIsPresent(copy.sectionIsPresent),-
198 flags(copy.flags)-
199{-
200}-
201-
202inline QUrlPrivate::~QUrlPrivate()-
203{-
204 delete error;-
205}-
206-
207inline QUrlPrivate::Error *QUrlPrivate::cloneError() const-
208{-
209 return error ? new Error(*error) : 0;-
210}-
211-
212inline void QUrlPrivate::clearError()-
213{-
214 delete error;-
215 error = 0;-
216}-
217-
218inline void QUrlPrivate::setError(ErrorCode errorCode, const QString &source, int supplement)-
219{-
220 if (error) {-
221-
222 return;-
223 }-
224 error = new Error;-
225 error->code = errorCode;-
226 error->source = source;-
227 error->position = supplement;-
228}-
229static const ushort userNameInIsolation[] = {-
230 ushort(':'),-
231 ushort('@'),-
232 ushort(']'),-
233 ushort('['),-
234 ushort('/'),-
235 ushort('?'),-
236 ushort('#'),-
237-
238 ushort('"'),-
239 ushort('<'),-
240 ushort('>'),-
241 ushort('^'),-
242 ushort('\\'),-
243 ushort('|'),-
244 ushort('{'),-
245 ushort('}'),-
246 0-
247};-
248static const ushort * const passwordInIsolation = userNameInIsolation + 1;-
249static const ushort * const pathInIsolation = userNameInIsolation + 5;-
250static const ushort * const queryInIsolation = userNameInIsolation + 6;-
251static const ushort * const fragmentInIsolation = userNameInIsolation + 7;-
252-
253static const ushort userNameInUserInfo[] = {-
254 ushort(0x200 | (':')),-
255 ushort('@'),-
256 ushort(']'),-
257 ushort('['),-
258 ushort('/'),-
259 ushort('?'),-
260 ushort('#'),-
261-
262 ushort('"'),-
263 ushort('<'),-
264 ushort('>'),-
265 ushort('^'),-
266 ushort('\\'),-
267 ushort('|'),-
268 ushort('{'),-
269 ushort('}'),-
270 0-
271};-
272static const ushort * const passwordInUserInfo = userNameInUserInfo + 1;-
273-
274static const ushort userNameInAuthority[] = {-
275 ushort(0x200 | (':')),-
276 ushort(0x200 | ('@')),-
277 ushort(0x200 | (']')),-
278 ushort(0x200 | ('[')),-
279 ushort('/'),-
280 ushort('?'),-
281 ushort('#'),-
282-
283 ushort('"'),-
284 ushort('<'),-
285 ushort('>'),-
286 ushort('^'),-
287 ushort('\\'),-
288 ushort('|'),-
289 ushort('{'),-
290 ushort('}'),-
291 0-
292};-
293static const ushort * const passwordInAuthority = userNameInAuthority + 1;-
294-
295static const ushort userNameInUrl[] = {-
296 ushort(0x200 | (':')),-
297 ushort(0x200 | ('@')),-
298 ushort(0x200 | (']')),-
299 ushort(0x200 | ('[')),-
300 ushort(0x200 | ('/')),-
301 ushort(0x200 | ('?')),-
302 ushort(0x200 | ('#')),-
303-
304-
305 0-
306};-
307static const ushort * const passwordInUrl = userNameInUrl + 1;-
308static const ushort * const pathInUrl = userNameInUrl + 5;-
309static const ushort * const queryInUrl = userNameInUrl + 6;-
310static const ushort * const fragmentInUrl = userNameInUrl + 6;-
311-
312static inline void parseDecodedComponent(QString &data)-
313{-
314 data.replace(QLatin1Char('%'), ([]() -> QString { enum { Size = sizeof(u"" "%25")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeofQLatin1String(QStringData) }, u"""%25" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()));));-
315}
executed 14930 times by 40 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QEventLoop
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QFtp
  • tst_QGraphicsProxyWidget
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSidebar
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • ...
14930
316-
317static inline QString-
318recodeFromUser(const QString &input, const ushort *actions, int from, int to)-
319{-
320 QString output;-
321 const QChar *begin = input.constData() + from;-
322 const QChar *end = input.constData() + to;-
323 if (qt_urlRecode(output, begin, end, 0, actions))-
324 return output;-
325-
326 return input.mid(from, to - from);-
327}-
328-
329-
330-
331static inline void appendToUser(QString &appendTo, const QString &value, QUrl::FormattingOptions options,-
332 const ushort *actions)-
333{-
334 if (options == QUrl::PrettyDecoded) {-
335 appendTo += value;-
336 return;-
337 }-
338-
339 if (!qt_urlRecode(appendTo, value.constData(), value.constEnd(), options, actions))-
340 appendTo += value;-
341}-
342-
343inline void QUrlPrivate::appendAuthority(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const-
344{-
345 if ((options & QUrl::RemoveUserInfo) != QUrl::RemoveUserInfo) {-
346 appendUserInfo(appendTo, options, appendingTo);-
347-
348-
349 if (hasUserName() || (hasPassword() && (options & QUrl::RemovePassword) == 0))-
350 appendTo += QLatin1Char('@');-
351 }-
352 appendHost(appendTo, options);-
353 if (!(options & QUrl::RemovePort) && port != -1)-
354 appendTo += QLatin1Char(':') + QString::number(port);-
355}-
356-
357inline void QUrlPrivate::appendUserInfo(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const-
358{-
359 if (__builtin_expect(!!(!hasUserInfo()), true))-
360 return;-
361-
362 const ushort *userNameActions;-
363 const ushort *passwordActions;-
364 if (options & QUrl::EncodeDelimiters) {-
365 userNameActions = userNameInUrl;-
366 passwordActions = passwordInUrl;-
367 } else {-
368 switch (appendingTo) {-
369 case UserInfo:-
370 userNameActions = userNameInUserInfo;-
371 passwordActions = passwordInUserInfo;-
372 break;-
373-
374 case Authority:-
375 userNameActions = userNameInAuthority;-
376 passwordActions = passwordInAuthority;-
377 break;-
378-
379 case FullUrl:-
380 userNameActions = userNameInUrl;-
381 passwordActions = passwordInUrl;-
382 break;-
383-
384 default:-
385-
386 do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,888894) : qt_noop()); __builtin_unreachable(); } while (0);-
387 break;-
388 }-
389 }-
390-
391 if (!qt_urlRecode(appendTo, userName.constData(), userName.constEnd(), options, userNameActions))-
392 appendTo += userName;-
393 if (options & QUrl::RemovePassword || !hasPassword()) {-
394 return;-
395 } else {-
396 appendTo += QLatin1Char(':');-
397 if (!qt_urlRecode(appendTo, password.constData(), password.constEnd(), options, passwordActions))-
398 appendTo += password;-
399 }-
400}-
401-
402inline void QUrlPrivate::appendUserName(QString &appendTo, QUrl::FormattingOptions options) const-
403{-
404-
405 appendToUser(appendTo, userName, options,-
406 options & QUrl::EncodeDelimiters ? userNameInUrl : userNameInIsolation);-
407}-
408-
409inline void QUrlPrivate::appendPassword(QString &appendTo, QUrl::FormattingOptions options) const-
410{-
411-
412 appendToUser(appendTo, password, options,-
413 options & QUrl::EncodeDelimiters ? passwordInUrl : passwordInIsolation);-
414}-
415-
416inline void QUrlPrivate::appendPath(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const-
417{-
418 QString thePath = path;-
419 if (options & QUrl::NormalizePathSegments) {-
420 thePath = qt_normalizePathSegments(path, false);-
421 }-
422 if (options & QUrl::RemoveFilename) {-
423 const int slash = path.lastIndexOf(QLatin1Char('/'));-
424 if (slash == -1)-
425 return;-
426 thePath = path.left(slash+1);-
427 }-
428-
429 if (options & QUrl::StripTrailingSlash) {-
430 while (thePath.length() > 1 && thePath.endsWith(QLatin1Char('/')))-
431 thePath.chop(1);-
432 }-
433-
434 appendToUser(appendTo, thePath, options,-
435 appendingTo == FullUrl || options & QUrl::EncodeDelimiters ? pathInUrl : pathInIsolation);-
436-
437}-
438-
439inline void QUrlPrivate::appendFragment(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const-
440{-
441 appendToUser(appendTo, fragment, options,-
442 options & QUrl::EncodeDelimiters ? fragmentInUrl :-
443 appendingTo == FullUrl ? 0 : fragmentInIsolation);-
444}-
445-
446inline void QUrlPrivate::appendQuery(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const-
447{-
448 appendToUser(appendTo, query, options,-
449 appendingTo == FullUrl || options & QUrl::EncodeDelimiters ? queryInUrl : queryInIsolation);-
450}-
451-
452-
453-
454inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetError)-
455{-
456-
457-
458-
459-
460-
461-
462-
463 scheme.clear();-
464 if (len == 0)-
465 return false;-
466-
467 sectionIsPresent |= Scheme;-
468-
469-
470 int needsLowercasing = -1;-
471 const ushort *p = reinterpret_cast<const ushort *>(value.constData());-
472 for (int i = 0; i < len; ++i) {-
473 if (p[i] >= 'a' && p[i] <= 'z')-
474 continue;-
475 if (p[i] >= 'A' && p[i] <= 'Z') {-
476 needsLowercasing = i;-
477 continue;-
478 }-
479 if (i) {-
480 if (p[i] >= '0' && p[i] <= '9')-
481 continue;-
482 if (p[i] == '+' || p[i] == '-' || p[i] == '.')-
483 continue;-
484 }-
485-
486-
487-
488-
489 if (doSetError)-
490 setError(InvalidSchemeError, value, i);-
491 return false;-
492 }-
493-
494 scheme = value.left(len);-
495-
496 if (needsLowercasing != -1) {-
497-
498 QChar *schemeData = scheme.data();-
499 for (int i = needsLowercasing; i >= 0; --i) {-
500 ushort c = schemeData[i].unicode();-
501 if (c >= 'A' && c <= 'Z')-
502 schemeData[i] = c + 0x20;-
503 }-
504 }-
505-
506-
507 if (scheme == fileScheme()-
508-
509-
510-
511 ) {-
512 flags |= IsLocalFile;-
513 } else {-
514 flags &= ~IsLocalFile;-
515 }-
516 return true;-
517}-
518-
519inline void QUrlPrivate::setAuthority(const QString &auth, int from, int end, QUrl::ParsingMode mode)-
520{-
521 sectionIsPresent &= ~Authority;-
522 sectionIsPresent |= Host;-
523-
524-
525 while (from != end) {-
526 int userInfoIndex = auth.indexOf(QLatin1Char('@'), from);-
527 if (uint(userInfoIndex) < uint(end)) {-
528 setUserInfo(auth, from, userInfoIndex);-
529 if (mode == QUrl::StrictMode && !validateComponent(UserInfo, auth, from, userInfoIndex))-
530 break;-
531 from = userInfoIndex + 1;-
532 }-
533-
534 int colonIndex = auth.lastIndexOf(QLatin1Char(':'), end - 1);-
535 if (colonIndex < from)-
536 colonIndex = -1;-
537-
538 if (uint(colonIndex) < uint(end)) {-
539 if (auth.at(from).unicode() == '[') {-
540-
541 int closingBracket = auth.indexOf(QLatin1Char(']'), from);-
542 if (uint(closingBracket) > uint(colonIndex))-
543 colonIndex = -1;-
544 }-
545 }-
546-
547 if (colonIndex == end - 1) {-
548-
549 port = -1;-
550 } else if (uint(colonIndex) < uint(end)) {-
551 unsigned long x = 0;-
552 for (int i = colonIndex + 1; i < end; ++i) {-
553 ushort c = auth.at(i).unicode();-
554 if (c >= '0' && c <= '9') {-
555 x *= 10;-
556 x += c - '0';-
557 } else {-
558 x = ulong(-1);-
559 break;-
560 }-
561 }-
562 if (x == ushort(x)) {-
563 port = ushort(x);-
564 } else {-
565 setError(InvalidPortError, auth, colonIndex + 1);-
566 if (mode == QUrl::StrictMode)-
567 break;-
568 }-
569 } else {-
570 port = -1;-
571 }-
572-
573 setHost(auth, from, qMin<uint>(end, colonIndex), mode);-
574 if (mode == QUrl::StrictMode && !validateComponent(Host, auth, from, qMin<uint>(end, colonIndex))) {-
575-
576 sectionIsPresent &= ~Authority;-
577 break;-
578 }-
579-
580-
581 return;-
582 }-
583-
584 sectionIsPresent &= ~Authority | Host;-
585 userName.clear();-
586 password.clear();-
587 host.clear();-
588 port = -1;-
589}-
590-
591inline void QUrlPrivate::setUserInfo(const QString &userInfo, int from, int end)-
592{-
593 int delimIndex = userInfo.indexOf(QLatin1Char(':'), from);-
594 setUserName(userInfo, from, qMin<uint>(delimIndex, end));-
595-
596 if (uint(delimIndex) >= uint(end)) {-
597 password.clear();-
598 sectionIsPresent &= ~Password;-
599 } else {-
600 setPassword(userInfo, delimIndex + 1, end);-
601 }-
602}-
603-
604inline void QUrlPrivate::setUserName(const QString &value, int from, int end)-
605{-
606 sectionIsPresent |= UserName;-
607 userName = recodeFromUser(value, userNameInIsolation, from, end);-
608}-
609-
610inline void QUrlPrivate::setPassword(const QString &value, int from, int end)-
611{-
612 sectionIsPresent |= Password;-
613 password = recodeFromUser(value, passwordInIsolation, from, end);-
614}-
615-
616inline void QUrlPrivate::setPath(const QString &value, int from, int end)-
617{-
618-
619 path = recodeFromUser(value, pathInIsolation, from, end);-
620}-
621-
622inline void QUrlPrivate::setFragment(const QString &value, int from, int end)-
623{-
624 sectionIsPresent |= Fragment;-
625 fragment = recodeFromUser(value, fragmentInIsolation, from, end);-
626}-
627-
628inline void QUrlPrivate::setQuery(const QString &value, int from, int iend)-
629{-
630 sectionIsPresent |= Query;-
631 query = recodeFromUser(value, queryInIsolation, from, iend);-
632}-
633inline void QUrlPrivate::appendHost(QString &appendTo, QUrl::FormattingOptions options) const-
634{-
635-
636 if ((options & QUrl::FullyDecoded) == QUrl::FullyDecoded)-
637 options = 0;-
638 else-
639 options &= QUrl::EncodeUnicode;-
640 if (host.isEmpty())-
641 return;-
642 if (host.at(0).unicode() == '[') {-
643-
644 appendTo += host;-
645 } else {-
646-
647-
648 if (options & QUrl::EncodeUnicode && !(options & 0x4000000))-
649 appendTo += qt_ACE_do(host, ToAceOnly, AllowLeadingDot);-
650 else-
651 appendTo += host;-
652 }-
653}-
654-
655-
656-
657static const QChar *parseIpFuture(QString &host, const QChar *begin, const QChar *end, QUrl::ParsingMode mode)-
658{-
659-
660 static const char acceptable[] =-
661 "!$&'()*+,;="-
662 ":"-
663 "-._~";-
664-
665-
666 const QChar *const origBegin = begin;-
667 if (begin[3].unicode() != '.')-
668 return &begin[3];-
669 if ((begin[2].unicode() >= 'A' && begin[2].unicode() <= 'F') ||-
670 (begin[2].unicode() >= 'a' && begin[2].unicode() <= 'f') ||-
671 (begin[2].unicode() >= '0' && begin[2].unicode() <= '9')) {-
672-
673-
674 host += QString::fromRawData(begin, 4);-
675-
676-
677 if (begin[2].unicode() >= 'a')-
678 host[host.length() - 2] = begin[2].unicode() - 0x20;-
679-
680 begin += 4;-
681 --end;-
682-
683 QString decoded;-
684 if (mode == QUrl::TolerantMode && qt_urlRecode(decoded, begin, end, QUrl::FullyDecoded, 0)) {-
685 begin = decoded.constBegin();-
686 end = decoded.constEnd();-
687 }-
688-
689 for ( ; begin != end; ++begin) {-
690 if (begin->unicode() >= 'A' && begin->unicode() <= 'Z')-
691 host += *begin;-
692 else if (begin->unicode() >= 'a' && begin->unicode() <= 'z')-
693 host += *begin;-
694 else if (begin->unicode() >= '0' && begin->unicode() <= '9')-
695 host += *begin;-
696 else if (begin->unicode() < 0x80 && strchr(acceptable, begin->unicode()) != 0)-
697 host += *begin;-
698 else-
699 return decoded.isEmpty() ? begin : &origBegin[2];-
700 }-
701 host += QLatin1Char(']');-
702 return 0;-
703 }-
704 return &origBegin[2];-
705}-
706-
707-
708static const QChar *parseIp6(QString &host, const QChar *begin, const QChar *end, QUrl::ParsingMode mode)-
709{-
710 QIPAddressUtils::IPv6Address address;-
711 const QChar *ret = QIPAddressUtils::parseIp6(address, begin, end);-
712 if (ret) {-
713-
714 const ushort decodeColon[] = { ushort(':'), 0 };-
715-
716-
717-
718 QString decoded;-
719 if (mode == QUrl::TolerantMode && qt_urlRecode(decoded, begin, end, 0, decodeColon)) {-
720-
721-
722 ret = parseIp6(host, decoded.constBegin(), decoded.constEnd(), mode);-
723-
724-
725 return ret ? end : 0;-
726 }-
727-
728-
729 return ret;-
730 }-
731-
732 host.reserve(host.size() + (end - begin));-
733 host += QLatin1Char('[');-
734 QIPAddressUtils::toString(host, address);-
735 host += QLatin1Char(']');-
736 return 0;-
737}-
738-
739inline bool QUrlPrivate::setHost(const QString &value, int from, int iend, QUrl::ParsingMode mode)-
740{-
741 const QChar *begin = value.constData() + from;-
742 const QChar *end = value.constData() + iend;-
743-
744 const int len = end - begin;-
745 host.clear();-
746 sectionIsPresent |= Host;-
747 if (len == 0)-
748 return true;-
749-
750 if (begin[0].unicode() == '[') {-
751-
752-
753-
754 if (end[-1].unicode() != ']') {-
755 setError(HostMissingEndBracket, value);-
756 return false;-
757 }-
758-
759 if (len > 5 && begin[1].unicode() == 'v') {-
760 const QChar *c = parseIpFuture(host, begin, end, mode);-
761 if (c)-
762 setError(InvalidIPvFutureError, value, c - value.constData());-
763 return !c;-
764 } else if (begin[1].unicode() == 'v') {-
765 setError(InvalidIPvFutureError, value, from);-
766 }-
767-
768 const QChar *c = parseIp6(host, begin + 1, end - 1, mode);-
769 if (!c)-
770 return true;-
771-
772 if (c == end - 1)-
773 setError(InvalidIPv6AddressError, value, from);-
774 else-
775 setError(InvalidCharacterInIPv6Error, value, c - value.constData());-
776 return false;-
777 }-
778-
779-
780 QIPAddressUtils::IPv4Address ip4;-
781 if (QIPAddressUtils::parseIp4(ip4, begin, end)) {-
782-
783 QIPAddressUtils::toString(host, ip4);-
784 return true;-
785 }-
786 QString s;-
787 if (mode == QUrl::TolerantMode && qt_urlRecode(s, begin, end, 0, 0)) {-
788-
789-
790 int pos = s.indexOf(QChar(0x25));-
791 if (pos != -1) {-
792 setError(InvalidRegNameError, s, pos);-
793 return false;-
794 }-
795-
796-
797 return setHost(s, 0, s.length(), QUrl::StrictMode);-
798 }-
799-
800 s = qt_ACE_do(QString::fromRawData(begin, len), NormalizeAce, ForbidLeadingDot);-
801 if (s.isEmpty()) {-
802 setError(InvalidRegNameError, value);-
803 return false;-
804 }-
805-
806-
807 if (QIPAddressUtils::parseIp4(ip4, s.constBegin(), s.constEnd())) {-
808 QIPAddressUtils::toString(host, ip4);-
809 } else {-
810 host = s;-
811 }-
812 return true;-
813}-
814-
815inline void QUrlPrivate::parse(const QString &url, QUrl::ParsingMode parsingMode)-
816{-
817 sectionIsPresent = 0;-
818 flags = 0;-
819 clearError();-
820-
821-
822 int colon = -1;-
823 int question = -1;-
824 int hash = -1;-
825 const int len = url.length();-
826 const QChar *const begin = url.constData();-
827 const ushort *const data = reinterpret_cast<const ushort *>(begin);-
828-
829 for (int i = 0; i < len; ++i) {-
830 uint uc = data[i];-
831 if (uc == '#' && hash == -1) {-
832 hash = i;-
833-
834-
835 break;-
836 }-
837-
838 if (question == -1) {-
839 if (uc == ':' && colon == -1)-
840 colon = i;-
841 else if (uc == '?')-
842 question = i;-
843 }-
844 }-
845-
846-
847 int hierStart;-
848 if (colon != -1 && setScheme(url, colon, false)) {-
849 hierStart = colon + 1;-
850 } else {-
851-
852 scheme.clear();-
853 sectionIsPresent = 0;-
854 hierStart = 0;-
855 }-
856-
857 int pathStart;-
858 int hierEnd = qMin<uint>(qMin<uint>(question, hash), len);-
859 if (hierEnd - hierStart >= 2 && data[hierStart] == '/' && data[hierStart + 1] == '/') {-
860-
861 int authorityEnd = hierEnd;-
862 for (int i = hierStart + 2; i < authorityEnd ; ++i) {-
863 if (data[i] == '/') {-
864 authorityEnd = i;-
865 break;-
866 }-
867 }-
868-
869 setAuthority(url, hierStart + 2, authorityEnd, parsingMode);-
870-
871-
872 pathStart = authorityEnd;-
873 setPath(url, pathStart, hierEnd);-
874 } else {-
875 userName.clear();-
876 password.clear();-
877 host.clear();-
878 port = -1;-
879 pathStart = hierStart;-
880-
881 if (hierStart < hierEnd)-
882 setPath(url, hierStart, hierEnd);-
883 else-
884 path.clear();-
885 }-
886-
887 if (uint(question) < uint(hash))-
888 setQuery(url, question + 1, qMin<uint>(hash, len));-
889-
890 if (hash != -1)-
891 setFragment(url, hash + 1, len);-
892-
893 if (error || parsingMode == QUrl::TolerantMode)-
894 return;-
895-
896-
897-
898-
899-
900-
901-
902 if (!validateComponent(Path, url, pathStart, hierEnd))-
903 return;-
904 if (uint(question) < uint(hash) && !validateComponent(Query, url, question + 1, qMin<uint>(hash, len)))-
905 return;-
906 if (hash != -1)-
907 validateComponent(Fragment, url, hash + 1, len);-
908}-
909-
910QString QUrlPrivate::toLocalFile(QUrl::FormattingOptions options) const-
911{-
912 QString tmp;-
913 QString ourPath;-
914 appendPath(ourPath, options, QUrlPrivate::Path);-
915-
916-
917 if (!host.isEmpty()
!host.isEmpty()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 10627 times by 15 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
) {
4-10627
918 tmp = ([]() -> QString { enum { Size = sizeofQLatin1String(u"""//") + host;-
919-
920-
921-
922-
923 if (!ourPath.isEmpty()
!ourPath.isEmpty()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
&& !ourPath.startsWith(QLatin1Char('/'))
!ourPath.start...tin1Char('/'))Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
)
1-3
924 tmp += QLatin1Char('/');
executed 1 time by 1 test: tmp += QLatin1Char('/');
Executed by:
  • tst_QUrl
1
925 tmp += ourPath;-
926 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QUrl
else {
4
927 tmp = ourPath;-
928-
929-
930-
931-
932-
933 }
executed 10627 times by 15 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
10627
934 return
executed 10631 times by 15 tests: return tmp;
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
tmp;
executed 10631 times by 15 tests: return tmp;
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QPlainTextEdit
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QTextEdit
  • tst_QUrl
  • tst_QXmlStream
  • tst_languageChange
  • tst_qfileopenevent
10631
935}-
936inline QString QUrlPrivate::mergePaths(const QString &relativePath) const-
937{-
938-
939-
940-
941 if (!host.isEmpty() && path.isEmpty())-
942 return QLatin1Char('/') + relativePath;-
943-
944-
945-
946-
947-
948-
949 QString newPath;-
950 if (!path.contains(QLatin1Char('/')))-
951 newPath = relativePath;-
952 else-
953 newPath = path.leftRef(path.lastIndexOf(QLatin1Char('/')) + 1) + relativePath;-
954-
955 return newPath;-
956}-
957-
958-
959-
960-
961-
962-
963-
964static void removeDotsFromPath(QString *path)-
965{-
966-
967-
968-
969 QChar *out = path->data();-
970 const QChar *in = out;-
971 const QChar *end = out + path->size();-
972-
973-
974-
975-
976 if (path->size() == 1 && in[0].unicode() == '.')-
977 ++in;-
978 else if (path->size() == 2 && in[0].unicode() == '.' && in[1].unicode() == '.')-
979 in += 2;-
980-
981 while (in < end) {-
982-
983-
984-
985 if (path->size() >= 2 && in[0].unicode() == '.' && in[1].unicode() == '/')-
986 in += 2;-
987 else if (path->size() >= 3 && in[0].unicode() == '.'-
988 && in[1].unicode() == '.' && in[2].unicode() == '/')-
989 in += 3;-
990-
991-
992-
993-
994 if (in <= end - 3 && in[0].unicode() == '/' && in[1].unicode() == '.'-
995 && in[2].unicode() == '/') {-
996 in += 2;-
997 continue;-
998 } else if (in == end - 2 && in[0].unicode() == '/' && in[1].unicode() == '.') {-
999 *out++ = QLatin1Char('/');-
1000 in += 2;-
1001 break;-
1002 }-
1003-
1004-
1005-
1006-
1007-
1008-
1009 if (in <= end - 4 && in[0].unicode() == '/' && in[1].unicode() == '.'-
1010 && in[2].unicode() == '.' && in[3].unicode() == '/') {-
1011 while (out > path->constData() && (--out)->unicode() != '/')-
1012 ;-
1013 if (out == path->constData() && out->unicode() != '/')-
1014 ++in;-
1015 in += 3;-
1016 continue;-
1017 } else if (in == end - 3 && in[0].unicode() == '/' && in[1].unicode() == '.'-
1018 && in[2].unicode() == '.') {-
1019 while (out > path->constData() && (--out)->unicode() != '/')-
1020 ;-
1021 if (out->unicode() == '/')-
1022 ++out;-
1023 in += 3;-
1024 break;-
1025 }-
1026-
1027-
1028-
1029-
1030-
1031-
1032-
1033 *out++ = *in++;-
1034 while (in < end && in->unicode() != '/')-
1035 *out++ = *in++;-
1036 }-
1037 path->truncate(out - path->constData());-
1038}-
1039-
1040inline QUrlPrivate::ErrorCode QUrlPrivate::validityError(QString *source, int *position) const-
1041{-
1042 ((!(!source == !position)) ? qt_assert("!source == !position",__FILE__,16071613) : qt_noop());-
1043 if (error) {-
1044 if (source) {-
1045 *source = error->source;-
1046 *position = error->position;-
1047 }-
1048 return error->code;-
1049 }-
1050 if (path.isEmpty() || path.at(0) == QLatin1Char('/'))-
1051 return NoError;-
1052 if (sectionIsPresent & QUrlPrivate::Host) {-
1053 if (source) {-
1054 *source = path;-
1055 *position = 0;-
1056 }-
1057 return AuthorityPresentAndPathIsRelative;-
1058 }-
1059 if (sectionIsPresent & QUrlPrivate::Scheme)-
1060 return NoError;-
1061-
1062-
1063 for (int i = 0; i < path.length(); ++i) {-
1064 ushort c = path.at(i).unicode();-
1065 if (c == '/') {-
1066-
1067 return NoError;-
1068 }-
1069 if (c == ':') {-
1070-
1071 if (source) {-
1072 *source = path;-
1073 *position = i;-
1074 }-
1075 return RelativeUrlPathContainsColonBeforeSlash;-
1076 }-
1077 }-
1078 return NoError;-
1079}-
1080-
1081bool QUrlPrivate::validateComponent(QUrlPrivate::Section section, const QString &input,-
1082 int begin, int end)-
1083{-
1084 static const char forbidden[] = "\"<>\\^`{|}\x7F";-
1085 static const char forbiddenUserInfo[] = ":/?#[]@";-
1086-
1087 ((!(section != Authority && section != Hierarchy && section != FullUrl)) ? qt_assert("section != Authority && section != Hierarchy && section != FullUrl",__FILE__,16771683) : qt_noop());-
1088-
1089 const ushort *const data = reinterpret_cast<const ushort *>(input.constData());-
1090 for (uint i = uint(begin); i < uint(end); ++i) {-
1091 uint uc = data[i];-
1092 if (uc >= 0x80)-
1093 continue;-
1094-
1095 bool error = false;-
1096 if ((uc == '%' && (uint(end) < i + 2 || !isHex(data[i + 1]) || !isHex(data[i + 2])))-
1097 || uc <= 0x20 || strchr(forbidden, uc)) {-
1098-
1099 error = true;-
1100 } else if (section & UserInfo) {-
1101 if (section == UserInfo && strchr(forbiddenUserInfo + 1, uc))-
1102 error = true;-
1103 else if (section != UserInfo && strchr(forbiddenUserInfo, uc))-
1104 error = true;-
1105 }-
1106-
1107 if (!error)-
1108 continue;-
1109-
1110 ErrorCode errorCode = ErrorCode(int(section) << 8);-
1111 if (section == UserInfo) {-
1112-
1113 errorCode = InvalidUserNameError;-
1114 for (uint j = uint(begin); j < i; ++j)-
1115 if (data[j] == ':') {-
1116 errorCode = InvalidPasswordError;-
1117 break;-
1118 }-
1119 }-
1120-
1121 setError(errorCode, input, i);-
1122 return false;-
1123 }-
1124-
1125-
1126 return true;-
1127}-
1128QUrl::QUrl(const QString &url, ParsingMode parsingMode) : d(0)-
1129{-
1130 setUrl(url, parsingMode);-
1131}-
1132-
1133-
1134-
1135-
1136QUrl::QUrl() : d(0)-
1137{-
1138}-
1139-
1140-
1141-
1142-
1143QUrl::QUrl(const QUrl &other) : d(other.d)-
1144{-
1145 if (d)-
1146 d->ref.ref();-
1147}-
1148-
1149-
1150-
1151-
1152QUrl::~QUrl()-
1153{-
1154 if (d && !d->ref.deref())-
1155 delete d;-
1156}-
1157bool QUrl::isValid() const-
1158{-
1159 if (isEmpty()) {-
1160-
1161 return false;-
1162 }-
1163 return d->validityError() == QUrlPrivate::NoError;-
1164}-
1165-
1166-
1167-
1168-
1169-
1170-
1171bool QUrl::isEmpty() const-
1172{-
1173 if (!d) return true;-
1174 return d->isEmpty();-
1175}-
1176void QUrl::clear()-
1177{-
1178 if (d && !d->ref.deref())-
1179 delete d;-
1180 d = 0;-
1181}-
1182void QUrl::setUrl(const QString &url, ParsingMode parsingMode)-
1183{-
1184 if (parsingMode == DecodedMode) {-
1185 QMessageLogger(__FILE__, 19021908, __PRETTY_FUNCTION__).warning("QUrl: QUrl::DecodedMode is not permitted when parsing a full URL");-
1186 } else {-
1187 detach();-
1188 d->parse(url, parsingMode);-
1189 }-
1190}-
1191void QUrl::setScheme(const QString &scheme)-
1192{-
1193 detach();-
1194 d->clearError();-
1195 if (scheme.isEmpty()) {-
1196-
1197 d->sectionIsPresent &= ~QUrlPrivate::Scheme;-
1198 d->flags &= ~QUrlPrivate::IsLocalFile;-
1199 d->scheme.clear();-
1200 } else {-
1201 d->setScheme(scheme, scheme.length(), true);-
1202 }-
1203}-
1204QString QUrl::scheme() const-
1205{-
1206 if (!d) return QString();-
1207-
1208 return d->scheme;-
1209}-
1210void QUrl::setAuthority(const QString &authority, ParsingMode mode)-
1211{-
1212 detach();-
1213 d->clearError();-
1214-
1215 if (mode == DecodedMode) {-
1216 QMessageLogger(__FILE__, 20162022, __PRETTY_FUNCTION__).warning("QUrl::setAuthority(): QUrl::DecodedMode is not permitted in this function");-
1217 return;-
1218 }-
1219-
1220 d->setAuthority(authority, 0, authority.length(), mode);-
1221 if (authority.isNull()) {-
1222-
1223-
1224 d->sectionIsPresent &= ~QUrlPrivate::Authority;-
1225 }-
1226}-
1227QString QUrl::authority(ComponentFormattingOptions options) const-
1228{-
1229 QString result;-
1230 if (!d
!dDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 177 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
)
1-177
1231 return
executed 1 time by 1 test: return result;
Executed by:
  • tst_QUrl
QString();result;
executed 1 time by 1 test: return result;
Executed by:
  • tst_QUrl
1
1232-
1233 if (options == QUrl::FullyDecoded
options == QUrl::FullyDecodedDescription
TRUEnever evaluated
FALSEevaluated 177 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
) {
0-177
1234 QMessageLogger(__FILE__, 20482056, __PRETTY_FUNCTION__).warning("QUrl::authority(): QUrl::FullyDecoded is not permitted in this function");-
1235 return
never executed: return result;
QString();
never executed: return result;
0
}
never executed: return result;
QString
never executed: return result;
never executed: return result;
result;
never executed: return result;
1236 }-
1237-
1238 d->appendAuthority(result, options, QUrlPrivate::Authority);-
1239 return
executed 177 times by 3 tests: return result;
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
result;
executed 177 times by 3 tests: return result;
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
177
1240}-
1241void QUrl::setUserInfo(const QString &userInfo, ParsingMode mode)-
1242{-
1243 detach();-
1244 d->clearError();-
1245 QString trimmed = userInfo.trimmed();-
1246 if (mode == DecodedMode) {-
1247 QMessageLogger(__FILE__, 20862093, __PRETTY_FUNCTION__).warning("QUrl::setUserInfo(): QUrl::DecodedMode is not permitted in this function");-
1248 return;-
1249 }-
1250-
1251 d->setUserInfo(trimmed, 0, trimmed.length());-
1252 if (userInfo.isNull()) {-
1253-
1254-
1255 d->sectionIsPresent &= ~QUrlPrivate::UserInfo;-
1256 } else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::UserInfo, userInfo)) {-
1257 d->sectionIsPresent &= ~QUrlPrivate::UserInfo;-
1258 d->userName.clear();-
1259 d->password.clear();-
1260 }-
1261}-
1262QString QUrl::userInfo(ComponentFormattingOptions options) const-
1263{-
1264 QString result;-
1265 if (!d
!dDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 2348 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
)
1-2348
1266 return
executed 1 time by 1 test: return result;
Executed by:
  • tst_QUrl
QString();result;
executed 1 time by 1 test: return result;
Executed by:
  • tst_QUrl
1
1267-
1268 if (options == QUrl::FullyDecoded
options == QUrl::FullyDecodedDescription
TRUEnever evaluated
FALSEevaluated 2348 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
) {
0-2348
1269 QMessageLogger(__FILE__, 21212130, __PRETTY_FUNCTION__).warning("QUrl::userInfo(): QUrl::FullyDecoded is not permitted in this function");-
1270 return
never executed: return result;
QString();
never executed: return result;
0
}
never executed: return result;
QString
never executed: return result;
never executed: return result;
result;
never executed: return result;
1271 }-
1272-
1273 d->appendUserInfo(result, options, QUrlPrivate::UserInfo);-
1274 return
executed 2348 times by 9 tests: return result;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
result;
executed 2348 times by 9 tests: return result;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
2348
1275}-
1276void QUrl::setUserName(const QString &userName, ParsingMode mode)-
1277{-
1278 detach();-
1279 d->clearError();-
1280-
1281 QString data = userName;-
1282 if (mode == DecodedMode) {-
1283 parseDecodedComponent(data);-
1284 mode = TolerantMode;-
1285 }-
1286-
1287 d->setUserName(data, 0, data.length());-
1288 if (userName.isNull())-
1289 d->sectionIsPresent &= ~QUrlPrivate::UserName;-
1290 else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::UserName, userName))-
1291 d->userName.clear();-
1292}-
1293QString QUrl::userName(ComponentFormattingOptions options) const-
1294{-
1295 if (!d) return QString();QString result;-
1296 if (d
dDescription
TRUEevaluated 783 times by 3 tests
Evaluated by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
)
2-783
1297 d->appendUserName(result, options);
executed 783 times by 3 tests: d->appendUserName(result, options);
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
783
1298 return
executed 785 times by 3 tests: return result;
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
result;
executed 785 times by 3 tests: return result;
Executed by:
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
785
1299}-
1300void QUrl::setPassword(const QString &password, ParsingMode mode)-
1301{-
1302 detach();-
1303 d->clearError();-
1304-
1305 QString data = password;-
1306 if (mode == DecodedMode) {-
1307 parseDecodedComponent(data);-
1308 mode = TolerantMode;-
1309 }-
1310-
1311 d->setPassword(data, 0, data.length());-
1312 if (password.isNull())-
1313 d->sectionIsPresent &= ~QUrlPrivate::Password;-
1314 else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Password, password))-
1315 d->password.clear();-
1316}-
1317QString QUrl::password(ComponentFormattingOptions options) const-
1318{-
1319 if (!d) return QString();QString result;-
1320 if (d
dDescription
TRUEevaluated 577 times by 6 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
)
2-577
1321 d->appendPassword(result, options);
executed 577 times by 6 tests: d->appendPassword(result, options);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
577
1322 return
executed 579 times by 6 tests: return result;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
result;
executed 579 times by 6 tests: return result;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
579
1323}-
1324void QUrl::setHost(const QString &host, ParsingMode mode)-
1325{-
1326 detach();-
1327 d->clearError();-
1328-
1329 QString data = host;-
1330 if (mode == DecodedMode) {-
1331 parseDecodedComponent(data);-
1332 mode = TolerantMode;-
1333 }-
1334-
1335 if (d->setHost(data, 0, data.length(), mode)) {-
1336 if (host.isNull())-
1337 d->sectionIsPresent &= ~QUrlPrivate::Host;-
1338 } else if (!data.startsWith(QLatin1Char('['))) {-
1339-
1340 ((!(d->error)) ? qt_assert("d->error",__FILE__,23512357) : qt_noop());-
1341-
1342 data.prepend(QLatin1Char('['));-
1343 data.append(QLatin1Char(']'));-
1344 if (!d->setHost(data, 0, data.length(), mode)) {-
1345-
1346 if (data.contains(QLatin1Char(':'))) {-
1347-
1348 d->error->code = QUrlPrivate::InvalidIPv6AddressError;-
1349 }-
1350 } else {-
1351-
1352 d->clearError();-
1353 }-
1354 }-
1355}-
1356QString QUrl::host(ComponentFormattingOptions options) const-
1357{-
1358 if (!d) return QString();QString result;-
1359 if (d
dDescription
TRUEevaluated 10012 times by 34 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • ...
FALSEevaluated 2578 times by 20 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QFtp
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkReply
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QTextStream
  • tst_QUdpSocket
  • tst_QUrl
  • tst_QXmlSimpleReader
) {
2578-10012
1360 d->appendHost(result, options);-
1361 if (result.startsWith(QLatin1Char('['))
result.startsW...tin1Char('['))Description
TRUEevaluated 53 times by 7 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
FALSEevaluated 9959 times by 34 tests
Evaluated by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • ...
)
53-9959
1362 returnresult =
executed 53 times by 7 tests: result = result.mid(1, result.length() - 2);
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
result.mid(1, result.length() - 2);
executed 53 times by 7 tests: result = result.mid(1, result.length() - 2);
Executed by:
  • tst_QNetworkCookieJar
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTcpServer
  • tst_QTcpSocket
  • tst_QUdpSocket
  • tst_QUrl
53
1363 }
executed 10012 times by 34 tests: end of block
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • ...
10012
1364 return
executed 12590 times by 34 tests: return result;
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • ...
result;
executed 12590 times by 34 tests: return result;
Executed by:
  • tst_Lancelot
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QEventLoop
  • tst_QFtp
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QHttpSocketEngine
  • tst_QIODevice
  • tst_QImageReader
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkInterface
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QObject
  • tst_QSocketNotifier
  • tst_QSocks5SocketEngine
  • tst_QSslSocket
  • tst_QSslSocket_onDemandCertificates_member
  • tst_QSslSocket_onDemandCertificates_static
  • tst_QTcpServer
  • ...
12590
1365}-
1366void QUrl::setPort(int port)-
1367{-
1368 detach();-
1369 d->clearError();-
1370-
1371 if (port < -1 || port > 65535) {-
1372 d->setError(QUrlPrivate::InvalidPortError, QString::number(port), 0);-
1373 port = -1;-
1374 }-
1375-
1376 d->port = port;-
1377}-
1378int QUrl::port(int defaultPort) const-
1379{-
1380 if (!d) return defaultPort;-
1381 return d->port == -1 ? defaultPort : d->port;-
1382}-
1383void QUrl::setPath(const QString &path, ParsingMode mode)-
1384{-
1385 detach();-
1386 d->clearError();-
1387-
1388 QString data = path;-
1389 if (mode == DecodedMode) {-
1390 parseDecodedComponent(data);-
1391 mode = TolerantMode;-
1392 }-
1393-
1394 int from = 0;-
1395 while (from < data.length() - 2 && data.midRef(from, 2) == QLatin1String("//"))-
1396 ++from;-
1397 d->setPath(data, from, data.length());-
1398-
1399-
1400-
1401-
1402-
1403 if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Path, path))-
1404 d->path.clear();-
1405}-
1406QString QUrl::path(ComponentFormattingOptions options) const-
1407{-
1408 if (!d) return QString();QString result;-
1409 if (d
dDescription
TRUEevaluated 4771 times by 19 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
FALSEevaluated 7 times by 3 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QTextBrowser
  • tst_QUrl
)
7-4771
1410 d->appendPath(result, options, QUrlPrivate::Path);
executed 4771 times by 19 tests: d->appendPath(result, options, QUrlPrivate::Path);
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
4771
1411 return
executed 4778 times by 20 tests: return result;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
result;
executed 4778 times by 20 tests: return result;
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMimeDatabase
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCookieJar
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_QXmlStream
  • tst_Spdy
  • tst_languageChange
4778
1412}-
1413QString QUrl::fileName(ComponentFormattingOptions options) const-
1414{-
1415 const QString ourPath = path(options);-
1416 const int slash = ourPath.lastIndexOf(QLatin1Char('/'));-
1417 if (slash == -1)-
1418 return ourPath;-
1419 return ourPath.mid(slash + 1);-
1420}-
1421bool QUrl::hasQuery() const-
1422{-
1423 if (!d) return false;-
1424 return d->hasQuery();-
1425}-
1426void QUrl::setQuery(const QString &query, ParsingMode mode)-
1427{-
1428 detach();-
1429 d->clearError();-
1430-
1431 QString data = query;-
1432 if (mode == DecodedMode) {-
1433 parseDecodedComponent(data);-
1434 mode = TolerantMode;-
1435 }-
1436-
1437 d->setQuery(data, 0, data.length());-
1438 if (query.isNull())-
1439 d->sectionIsPresent &= ~QUrlPrivate::Query;-
1440 else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Query, query))-
1441 d->query.clear();-
1442}-
1443void QUrl::setQuery(const QUrlQuery &query)-
1444{-
1445 detach();-
1446 d->clearError();-
1447-
1448-
1449 d->query = query.toString();-
1450 if (query.isEmpty())-
1451 d->sectionIsPresent &= ~QUrlPrivate::Query;-
1452 else-
1453 d->sectionIsPresent |= QUrlPrivate::Query;-
1454}-
1455QString QUrl::query(ComponentFormattingOptions options) const-
1456{-
1457 if (!d) return QString();QString result;-
1458 if (d
dDescription
TRUEevaluated 189 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
) {
2-189
1459 d->appendQuery(result, options, QUrlPrivate::Query);-
1460 if (d->hasQuery()
d->hasQuery()Description
TRUEevaluated 166 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 23 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
&& result.isNull()
result.isNull()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 164 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
)
2-166
1461 result.detach();
executed 2 times by 1 test: result.detach();
Executed by:
  • tst_QUrl
2
1462 }
executed 189 times by 3 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
189
1463 return
executed 191 times by 3 tests: return result;
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
result;
executed 191 times by 3 tests: return result;
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
191
1464}-
1465void QUrl::setFragment(const QString &fragment, ParsingMode mode)-
1466{-
1467 detach();-
1468 d->clearError();-
1469-
1470 QString data = fragment;-
1471 if (mode == DecodedMode) {-
1472 parseDecodedComponent(data);-
1473 mode = TolerantMode;-
1474 }-
1475-
1476 d->setFragment(data, 0, data.length());-
1477 if (fragment.isNull())-
1478 d->sectionIsPresent &= ~QUrlPrivate::Fragment;-
1479 else if (mode == StrictMode && !d->validateComponent(QUrlPrivate::Fragment, fragment))-
1480 d->fragment.clear();-
1481}-
1482QString QUrl::fragment(ComponentFormattingOptions options) const-
1483{-
1484 if (!d) return QString();QString result;-
1485 if (d
dDescription
TRUEevaluated 128 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
) {
2-128
1486 d->appendFragment(result, options, QUrlPrivate::Fragment);-
1487 if (d->hasFragment()
d->hasFragment()Description
TRUEevaluated 59 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
FALSEevaluated 69 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
&& result.isNull()
result.isNull()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 57 times by 2 tests
Evaluated by:
  • tst_QTextBrowser
  • tst_QUrl
)
2-69
1488 result.detach();
executed 2 times by 1 test: result.detach();
Executed by:
  • tst_QUrl
2
1489 }
executed 128 times by 2 tests: end of block
Executed by:
  • tst_QTextBrowser
  • tst_QUrl
128
1490 return
executed 130 times by 2 tests: return result;
Executed by:
  • tst_QTextBrowser
  • tst_QUrl
result;
executed 130 times by 2 tests: return result;
Executed by:
  • tst_QTextBrowser
  • tst_QUrl
130
1491}-
1492bool QUrl::hasFragment() const-
1493{-
1494 if (!d) return false;-
1495 return d->hasFragment();-
1496}-
1497QString QUrl::topLevelDomain(ComponentFormattingOptions options) const-
1498{-
1499 QString tld = qTopLevelDomain(host());-
1500 if (options & EncodeUnicode) {-
1501 return qt_ACE_do(tld, ToAceOnly, AllowLeadingDot);-
1502 }-
1503 return tld;-
1504}-
1505QUrl QUrl::resolved(const QUrl &relative) const-
1506{-
1507 if (!d) return relative;-
1508 if (!relative.d) return *this;-
1509-
1510 QUrl t;-
1511-
1512 if (!relative.d->scheme.isEmpty() && (!relative.isLocalFile() || QDir::isAbsolutePath(relative.d->path))) {-
1513 t = relative;-
1514 t.detach();-
1515 } else {-
1516 if (relative.d->hasAuthority()) {-
1517 t = relative;-
1518 t.detach();-
1519 } else {-
1520 t.d = new QUrlPrivate;-
1521-
1522-
1523 t.d->userName = d->userName;-
1524 t.d->password = d->password;-
1525 t.d->host = d->host;-
1526 t.d->port = d->port;-
1527 t.d->sectionIsPresent = d->sectionIsPresent & QUrlPrivate::Authority;-
1528-
1529 if (relative.d->path.isEmpty()) {-
1530 t.d->path = d->path;-
1531 if (relative.d->hasQuery()) {-
1532 t.d->query = relative.d->query;-
1533 t.d->sectionIsPresent |= QUrlPrivate::Query;-
1534 } else if (d->hasQuery()) {-
1535 t.d->query = d->query;-
1536 t.d->sectionIsPresent |= QUrlPrivate::Query;-
1537 }-
1538 } else {-
1539 t.d->path = relative.d->path.startsWith(QLatin1Char('/'))-
1540 ? relative.d->path-
1541 : d->mergePaths(relative.d->path);-
1542 if (relative.d->hasQuery()) {-
1543 t.d->query = relative.d->query;-
1544 t.d->sectionIsPresent |= QUrlPrivate::Query;-
1545 }-
1546 }-
1547 }-
1548 t.d->scheme = d->scheme;-
1549 if (d->hasScheme())-
1550 t.d->sectionIsPresent |= QUrlPrivate::Scheme;-
1551 else-
1552 t.d->sectionIsPresent &= ~QUrlPrivate::Scheme;-
1553 t.d->flags |= d->flags & QUrlPrivate::IsLocalFile;-
1554 }-
1555 t.d->fragment = relative.d->fragment;-
1556 if (relative.d->hasFragment())-
1557 t.d->sectionIsPresent |= QUrlPrivate::Fragment;-
1558 else-
1559 t.d->sectionIsPresent &= ~QUrlPrivate::Fragment;-
1560-
1561 removeDotsFromPath(&t.d->path);-
1562-
1563-
1564-
1565-
1566-
1567-
1568-
1569 return t;-
1570}-
1571bool QUrl::isRelative() const-
1572{-
1573 if (!d) return true;-
1574 return !d->hasScheme();-
1575}-
1576QString QUrl::url(FormattingOptions options) const-
1577{-
1578 return toString(options);-
1579}-
1580QString QUrl::toString(FormattingOptions options) const-
1581{-
1582 QString url;-
1583 if (!isValid()
!isValid()Description
TRUEevaluated 149 times by 5 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
FALSEevaluated 9039 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
) {
149-9039
1584-
1585 return
executed 149 times by 5 tests: return url;
Executed by:
  • tst_QFileDialog2
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
QString();url;
executed 149 times by 5 tests: return url;
Executed by:
  • tst_QFileDialog2
  • tst_QTextBrowser
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
149
1586 }-
1587 if (options == QUrl::FullyDecoded
options == QUrl::FullyDecodedDescription
TRUEnever evaluated
FALSEevaluated 9039 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
) {
0-9039
1588 QMessageLogger(__FILE__, 32763282, __PRETTY_FUNCTION__).warning("QUrl: QUrl::FullyDecoded is not permitted when reconstructing the full URL");-
1589 options = QUrl::PrettyDecoded;-
1590 }
never executed: end of block
0
1591-
1592-
1593-
1594-
1595-
1596-
1597-
1598 if (options.testFlag(QUrl::PreferLocalFile)
options.testFl...eferLocalFile)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 9032 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
&& !options.testFlag(QUrl::RemovePath)
!options.testF...l::RemovePath)Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
0-9032
1599 && (!d->hasQuery()
!d->hasQuery()Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
|| options.testFlag(QUrl::RemoveQuery)
options.testFl...::RemoveQuery)Description
TRUEnever evaluated
FALSEnever evaluated
)
0-7
1600 && (!d->hasFragment()
!d->hasFragment()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
|| options.testFlag(QUrl::RemoveFragment)
options.testFl...emoveFragment)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
)
0-6
1601 && isLocalFile()
isLocalFile()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
) {
2-4
1602 returnurl = d->toLocalFile(options);-
1603 }4
QStringreturn
executed 4 times by 1 test: return url;
Executed by:
  • tst_QUrl
executed 4 times by 1 test: return url;
Executed by:
  • tst_QUrl
url;
executed 4 times by 1 test: return url;
Executed by:
  • tst_QUrl
1604 }-
1605-
1606-
1607 if (options & DecodeReserved
options & DecodeReservedDescription
TRUEevaluated 35 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 9000 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
)
35-9000
1608 options &= ~EncodeReserved;
executed 35 times by 1 test: options &= ~EncodeReserved;
Executed by:
  • tst_QUrl
35
1609 else-
1610 options |= EncodeReserved;
executed 9000 times by 28 tests: options |= EncodeReserved;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
9000
1611-
1612 if (!(options & QUrl::RemoveScheme)
!(options & QU...:RemoveScheme)Description
TRUEevaluated 7044 times by 27 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • ...
FALSEevaluated 1991 times by 10 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
&& d->hasScheme()
d->hasScheme()Description
TRUEevaluated 6834 times by 25 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
FALSEevaluated 210 times by 6 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
)
210-7044
1613 url += d->scheme + QLatin1Char(':');
executed 6834 times by 25 tests: url += d->scheme + QLatin1Char(':');
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
6834
1614-
1615 bool pathIsAbsolute = d->path.startsWith(QLatin1Char('/'));-
1616 if (!((options & QUrl::RemoveAuthority) == QUrl::RemoveAuthority)
!((options & Q...moveAuthority)Description
TRUEevaluated 7073 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
FALSEevaluated 1962 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
&& d->hasAuthority()
d->hasAuthority()Description
TRUEevaluated 5452 times by 20 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
FALSEevaluated 1621 times by 14 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_languageChange
) {
1621-7073
1617 url += QLatin1String("//");-
1618 d->appendAuthority(url, options, QUrlPrivate::FullUrl);-
1619 }
executed 5452 times by 20 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QFileSelector
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
else if (isLocalFile()
isLocalFile()Description
TRUEevaluated 1323 times by 9 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_languageChange
FALSEevaluated 2260 times by 15 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
&& pathIsAbsolute
pathIsAbsoluteDescription
TRUEevaluated 1038 times by 9 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_languageChange
FALSEevaluated 285 times by 6 tests
Evaluated by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QTextBrowser
  • tst_QUrl
  • tst_languageChange
) {
285-5452
1620-
1621 url += QLatin1String("//");-
1622 }
executed 1038 times by 9 tests: end of block
Executed by:
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QNetworkReply
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QUrl
  • tst_languageChange
1038
1623-
1624 if (!(options & QUrl::RemovePath)
!(options & QUrl::RemovePath)Description
TRUEevaluated 7129 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
FALSEevaluated 1906 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
)
1906-7129
1625 d->appendPath(url, options, QUrlPrivate::FullUrl);
executed 7129 times by 28 tests: d->appendPath(url, options, QUrlPrivate::FullUrl);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
7129
1626-
1627 if (!(options & QUrl::RemoveQuery)
!(options & QUrl::RemoveQuery)Description
TRUEevaluated 7121 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
FALSEevaluated 1914 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
&& d->hasQuery()
d->hasQuery()Description
TRUEevaluated 535 times by 4 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 6586 times by 28 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
) {
535-7121
1628 url += QLatin1Char('?');-
1629 d->appendQuery(url, options, QUrlPrivate::FullUrl);-
1630 }
executed 535 times by 4 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QNetworkReply
  • tst_QUrl
  • tst_Spdy
535
1631 if (!(options & QUrl::RemoveFragment)
!(options & QU...emoveFragment)Description
TRUEevaluated 6032 times by 25 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
FALSEevaluated 3003 times by 9 tests
Evaluated by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QUrl
  • tst_QXmlInputSource
  • tst_Spdy
&& d->hasFragment()
d->hasFragment()Description
TRUEevaluated 792 times by 4 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
FALSEevaluated 5240 times by 25 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_Spdy
  • tst_languageChange
  • tst_qdesktopservices
  • tst_qfileopenevent
  • tst_selftests - unknown status
) {
792-6032
1632 url += QLatin1Char('#');-
1633 d->appendFragment(url, options, QUrlPrivate::FullUrl);-
1634 }
executed 792 times by 4 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_QTextBrowser
  • tst_QUrl
  • tst_Spdy
792
1635-
1636 return
executed 9035 times by 28 tests: return url;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
url;
executed 9035 times by 28 tests: return url;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QDataUrl
  • tst_QFileDialog2
  • tst_QFileSelector
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QMimeData
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkCacheMetaData
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QNetworkRequest
  • tst_QSidebar
  • tst_QTextBrowser
  • tst_QTextDocument
  • tst_QTextDocumentFragment
  • tst_QUrl
  • tst_QVariant
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_languageChange
  • ...
9035
1637}-
1638QString QUrl::toDisplayString(FormattingOptions options) const-
1639{-
1640 return toString(options | RemovePassword);-
1641}-
1642QUrl QUrl::adjusted(QUrl::FormattingOptions options) const-
1643{-
1644 if (!isValid()) {-
1645-
1646 return QUrl();-
1647 }-
1648 QUrl that = *this;-
1649 if (options & RemoveScheme)-
1650 that.setScheme(QString());-
1651 if ((options & RemoveAuthority) == RemoveAuthority) {-
1652 that.setAuthority(QString());-
1653 } else {-
1654 if ((options & RemoveUserInfo) == RemoveUserInfo)-
1655 that.setUserInfo(QString());-
1656 else if (options & RemovePassword)-
1657 that.setPassword(QString());-
1658 if (options & RemovePort)-
1659 that.setPort(-1);-
1660 }-
1661 if (options & RemoveQuery)-
1662 that.setQuery(QString());-
1663 if (options & RemoveFragment)-
1664 that.setFragment(QString());-
1665 if (options & RemovePath) {-
1666 that.setPath(QString());-
1667 } else if (options & (StripTrailingSlash | RemoveFilename | NormalizePathSegments)) {-
1668 that.detach();-
1669 QString path;-
1670 d->appendPath(path, options | FullyEncoded, QUrlPrivate::Path);-
1671 that.d->setPath(path, 0, path.length());-
1672 }-
1673 return that;-
1674}-
1675QByteArray QUrl::toEncoded(FormattingOptions options) const-
1676{-
1677 options &= ~(FullyDecoded | FullyEncoded);-
1678 QString stringForm = toString(options | FullyEncoded);-
1679 return stringForm.toLatin1();-
1680}-
1681QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode mode)-
1682{-
1683 return QUrl(QString::fromUtf8(input.constData(), input.size()), mode);-
1684}-
1685-
1686-
1687-
1688-
1689-
1690QString QUrl::fromPercentEncoding(const QByteArray &input)-
1691{-
1692 QByteArray ba = QByteArray::fromPercentEncoding(input);-
1693 return QString::fromUtf8(ba, ba.size());-
1694}-
1695QByteArray QUrl::toPercentEncoding(const QString &input, const QByteArray &exclude, const QByteArray &include)-
1696{-
1697 return input.toUtf8().toPercentEncoding(exclude, include);-
1698}-
1699QString QUrl::fromEncodedComponent_helper(const QByteArray &ba)-
1700{-
1701 return qt_urlRecodeByteArray(ba);-
1702}-
1703QString QUrl::fromAce(const QByteArray &domain)-
1704{-
1705 return qt_ACE_do(QString::fromLatin1(domain), NormalizeAce, ForbidLeadingDot );-
1706}-
1707QByteArray QUrl::toAce(const QString &domain)-
1708{-
1709 QString result = qt_ACE_do(domain, ToAceOnly, ForbidLeadingDot );-
1710 return result.toLatin1();-
1711}-
1712-
1713-
1714-
1715-
1716-
1717-
1718-
1719bool QUrl::operator <(const QUrl &url) const-
1720{-
1721 if (!d || !url.d) {-
1722 bool thisIsEmpty = !d || d->isEmpty();-
1723 bool thatIsEmpty = !url.d || url.d->isEmpty();-
1724-
1725-
1726 return thisIsEmpty && !thatIsEmpty;-
1727 }-
1728-
1729 int cmp;-
1730 cmp = d->scheme.compare(url.d->scheme);-
1731 if (cmp != 0)-
1732 return cmp < 0;-
1733-
1734 cmp = d->userName.compare(url.d->userName);-
1735 if (cmp != 0)-
1736 return cmp < 0;-
1737-
1738 cmp = d->password.compare(url.d->password);-
1739 if (cmp != 0)-
1740 return cmp < 0;-
1741-
1742 cmp = d->host.compare(url.d->host);-
1743 if (cmp != 0)-
1744 return cmp < 0;-
1745-
1746 if (d->port != url.d->port)-
1747 return d->port < url.d->port;-
1748-
1749 cmp = d->path.compare(url.d->path);-
1750 if (cmp != 0)-
1751 return cmp < 0;-
1752-
1753 if (d->hasQuery() != url.d->hasQuery())-
1754 return url.d->hasQuery();-
1755-
1756 cmp = d->query.compare(url.d->query);-
1757 if (cmp != 0)-
1758 return cmp < 0;-
1759-
1760 if (d->hasFragment() != url.d->hasFragment())-
1761 return url.d->hasFragment();-
1762-
1763 cmp = d->fragment.compare(url.d->fragment);-
1764 return cmp < 0;-
1765}-
1766-
1767-
1768-
1769-
1770-
1771bool QUrl::operator ==(const QUrl &url) const-
1772{-
1773 if (!d && !url.d)-
1774 return true;-
1775 if (!d)-
1776 return url.d->isEmpty();-
1777 if (!url.d)-
1778 return d->isEmpty();-
1779-
1780-
1781-
1782-
1783-
1784 int mask = QUrlPrivate::FullUrl;-
1785 if (isLocalFile())-
1786 mask &= ~QUrlPrivate::Host;-
1787 return (d->sectionIsPresent & mask) == (url.d->sectionIsPresent & mask) &&-
1788 d->scheme == url.d->scheme &&-
1789 d->userName == url.d->userName &&-
1790 d->password == url.d->password &&-
1791 d->host == url.d->host &&-
1792 d->port == url.d->port &&-
1793 d->path == url.d->path &&-
1794 d->query == url.d->query &&-
1795 d->fragment == url.d->fragment;-
1796}-
1797bool QUrl::matches(const QUrl &url, FormattingOptions options) const-
1798{-
1799 if (!d && !url.d)-
1800 return true;-
1801 if (!d)-
1802 return url.d->isEmpty();-
1803 if (!url.d)-
1804 return d->isEmpty();-
1805-
1806-
1807-
1808-
1809-
1810 int mask = QUrlPrivate::FullUrl;-
1811 if (isLocalFile())-
1812 mask &= ~QUrlPrivate::Host;-
1813-
1814 if (options & QUrl::RemoveScheme)-
1815 mask &= ~QUrlPrivate::Scheme;-
1816 else if (d->scheme != url.d->scheme)-
1817 return false;-
1818-
1819 if (options & QUrl::RemovePassword)-
1820 mask &= ~QUrlPrivate::Password;-
1821 else if (d->password != url.d->password)-
1822 return false;-
1823-
1824 if (options & QUrl::RemoveUserInfo)-
1825 mask &= ~QUrlPrivate::UserName;-
1826 else if (d->userName != url.d->userName)-
1827 return false;-
1828-
1829 if (options & QUrl::RemovePort)-
1830 mask &= ~QUrlPrivate::Port;-
1831 else if (d->port != url.d->port)-
1832 return false;-
1833-
1834 if (options & QUrl::RemoveAuthority)-
1835 mask &= ~QUrlPrivate::Host;-
1836 else if (d->host != url.d->host)-
1837 return false;-
1838-
1839 if (options & QUrl::RemoveQuery)-
1840 mask &= ~QUrlPrivate::Query;-
1841 else if (d->query != url.d->query)-
1842 return false;-
1843-
1844 if (options & QUrl::RemoveFragment)-
1845 mask &= ~QUrlPrivate::Fragment;-
1846 else if (d->fragment != url.d->fragment)-
1847 return false;-
1848-
1849 if ((d->sectionIsPresent & mask) != (url.d->sectionIsPresent & mask))-
1850 return false;-
1851-
1852 if (options & QUrl::RemovePath)-
1853 return true;-
1854-
1855-
1856 QString path1;-
1857 d->appendPath(path1, options, QUrlPrivate::Path);-
1858 QString path2;-
1859 url.d->appendPath(path2, options, QUrlPrivate::Path);-
1860 return path1 == path2;-
1861}-
1862-
1863-
1864-
1865-
1866-
1867bool QUrl::operator !=(const QUrl &url) const-
1868{-
1869 return !(*this == url);-
1870}-
1871-
1872-
1873-
1874-
1875QUrl &QUrl::operator =(const QUrl &url)-
1876{-
1877 if (!d) {-
1878 if (url.d) {-
1879 url.d->ref.ref();-
1880 d = url.d;-
1881 }-
1882 } else {-
1883 if (url.d)-
1884 qAtomicAssign(d, url.d);-
1885 else-
1886 clear();-
1887 }-
1888 return *this;-
1889}-
1890-
1891-
1892-
1893-
1894QUrl &QUrl::operator =(const QString &url)-
1895{-
1896 if (url.isEmpty()) {-
1897 clear();-
1898 } else {-
1899 detach();-
1900 d->parse(url, TolerantMode);-
1901 }-
1902 return *this;-
1903}-
1904void QUrl::detach()-
1905{-
1906 if (!d)-
1907 d = new QUrlPrivate;-
1908 else-
1909 qAtomicDetach(d);-
1910}-
1911-
1912-
1913-
1914-
1915bool QUrl::isDetached() const-
1916{-
1917 return !d || d->ref.load() == 1;-
1918}-
1919QUrl QUrl::fromLocalFile(const QString &localFile)-
1920{-
1921 QUrl url;-
1922 if (localFile.isEmpty())-
1923 return url;-
1924 QString scheme = fileScheme();-
1925 QString deslashified = QDir::fromNativeSeparators(localFile);-
1926-
1927-
1928 if (deslashified.length() > 1 && deslashified.at(1) == QLatin1Char(':') && deslashified.at(0) != QLatin1Char('/')) {-
1929 deslashified.prepend(QLatin1Char('/'));-
1930 } else if (deslashified.startsWith(QLatin1String("//"))) {-
1931-
1932 int indexOfPath = deslashified.indexOf(QLatin1Char('/'), 2);-
1933 QString hostSpec = deslashified.mid(2, indexOfPath - 2);-
1934-
1935 if (hostSpec.endsWith(webDavSslTag(), Qt::CaseInsensitive)) {-
1936 hostSpec.chop(4);-
1937 scheme = webDavScheme();-
1938 }-
1939 url.setHost(hostSpec);-
1940-
1941 if (indexOfPath > 2)-
1942 deslashified = deslashified.right(deslashified.length() - indexOfPath);-
1943 else-
1944 deslashified.clear();-
1945 }-
1946-
1947 url.setScheme(scheme);-
1948 url.setPath(deslashified, DecodedMode);-
1949 return url;-
1950}-
1951QString QUrl::toLocalFile() const-
1952{-
1953-
1954 if (!isLocalFile())-
1955 return QString();-
1956-
1957 return d->toLocalFile(QUrl::FullyDecoded);-
1958}-
1959bool QUrl::isLocalFile() const-
1960{-
1961 return d && d->isLocalFile();-
1962}-
1963-
1964-
1965-
1966-
1967-
1968-
1969bool QUrl::isParentOf(const QUrl &childUrl) const-
1970{-
1971 QString childPath = childUrl.path();-
1972-
1973 if (!d)-
1974 return ((childUrl.scheme().isEmpty())-
1975 && (childUrl.authority().isEmpty())-
1976 && childPath.length() > 0 && childPath.at(0) == QLatin1Char('/'));-
1977-
1978 QString ourPath = path();-
1979-
1980 return ((childUrl.scheme().isEmpty() || d->scheme == childUrl.scheme())-
1981 && (childUrl.authority().isEmpty() || authority() == childUrl.authority())-
1982 && childPath.startsWith(ourPath)-
1983 && ((ourPath.endsWith(QLatin1Char('/')) && childPath.length() > ourPath.length())-
1984 || (!ourPath.endsWith(QLatin1Char('/'))-
1985 && childPath.length() > ourPath.length() && childPath.at(ourPath.length()) == QLatin1Char('/'))));-
1986}-
1987QDataStream &operator<<(QDataStream &out, const QUrl &url)-
1988{-
1989 QByteArray u;-
1990 if (url.isValid())-
1991 u = url.toEncoded();-
1992 out << u;-
1993 return out;-
1994}-
1995QDataStream &operator>>(QDataStream &in, QUrl &url)-
1996{-
1997 QByteArray u;-
1998 in >> u;-
1999 url.setUrl(QString::fromLatin1(u));-
2000 return in;-
2001}-
2002-
2003-
2004-
2005QDebug operator<<(QDebug d, const QUrl &url)-
2006{-
2007 QDebugStateSaver saver(d);-
2008 d.nospace() << "QUrl(" << url.toDisplayString() << ')';-
2009 return d;-
2010}-
2011-
2012-
2013static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &errorSource, int errorPosition)-
2014{-
2015 QChar c = uint(errorPosition) < uint(errorSource.length()) ?-
2016 errorSource.at(errorPosition) : QChar(QChar::Null);-
2017-
2018 switch (errorCode) {-
2019 case QUrlPrivate::NoError:-
2020 ((!(false)) ? qt_assert_x("QUrl::errorString", "Impossible: QUrl::errorString should have treated this condition",-
2021 __FILE__-
2022 ,-
2023 39503955-
2024 ) : qt_noop())-
2025 ;-
2026 do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,39513956) : qt_noop()); __builtin_unreachable(); } while (0);-
2027 return QString();-
2028-
2029 case QUrlPrivate::InvalidSchemeError: {-
2030 QString msg = ([]() -> QString { enum { Size = sizeof(u"" "Invalid scheme (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid scheme (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());-
2031 return msg.arg(c);-
2032 }-
2033-
2034 case QUrlPrivate::InvalidUserNameError:-
2035 return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid user name (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid user name (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()))-
2036 .arg(c);-
2037-
2038 case QUrlPrivate::InvalidPasswordError:-
2039 return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid password (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid password (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()))-
2040 .arg(c);-
2041-
2042 case QUrlPrivate::InvalidRegNameError:-
2043 if (errorPosition != -1)-
2044 return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid hostname (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid hostname (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()))-
2045 .arg(c);-
2046 else-
2047 return ([]() -> QString { enum { Size = sizeof(u"" "Invalid hostname (contains invalid characters)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid hostname (contains invalid characters)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());-
2048 case QUrlPrivate::InvalidIPv4AddressError:-
2049 return QString();-
2050 case QUrlPrivate::InvalidIPv6AddressError:-
2051 return ([]() -> QString { enum { Size = sizeof(u"" "Invalid IPv6 address")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid IPv6 address" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());-
2052 case QUrlPrivate::InvalidCharacterInIPv6Error:-
2053 return ([]() -> QString { enum { Size = sizeof(u"" "Invalid IPv6 address (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid IPv6 address (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()).arg(c);-
2054 case QUrlPrivate::InvalidIPvFutureError:-
2055 return ([]() -> QString { enum { Size = sizeof(u"" "Invalid IPvFuture address (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid IPvFuture address (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()).arg(c);-
2056 case QUrlPrivate::HostMissingEndBracket:-
2057 return ([]() -> QString { enum { Size = sizeof(u"" "Expected ']' to match '[' in hostname")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Expected ']' to match '[' in hostname" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());-
2058-
2059 case QUrlPrivate::InvalidPortError:-
2060 return ([]() -> QString { enum { Size = sizeof(u"" "Invalid port or port number out of range")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid port or port number out of range" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());-
2061 case QUrlPrivate::PortEmptyError:-
2062 return ([]() -> QString { enum { Size = sizeof(u"" "Port field was empty")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Port field was empty" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());-
2063-
2064 case QUrlPrivate::InvalidPathError:-
2065 return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid path (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid path (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()))-
2066 .arg(c);-
2067-
2068 case QUrlPrivate::InvalidQueryError:-
2069 return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid query (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid query (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()))-
2070 .arg(c);-
2071-
2072 case QUrlPrivate::InvalidFragmentError:-
2073 return QString(([]() -> QString { enum { Size = sizeof(u"" "Invalid fragment (character '%1' not permitted)")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Invalid fragment (character '%1' not permitted)" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()))-
2074 .arg(c);-
2075-
2076 case QUrlPrivate::AuthorityPresentAndPathIsRelative:-
2077 return ([]() -> QString { enum { Size = sizeof(u"" "Path component is relative and authority is present")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Path component is relative and authority is present" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());-
2078 case QUrlPrivate::RelativeUrlPathContainsColonBeforeSlash:-
2079 return ([]() -> QString { enum { Size = sizeof(u"" "Relative URL's path component contains ':' before any '/'")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "Relative URL's path component contains ':' before any '/'" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());-
2080 }-
2081-
2082 ((!(false)) ? qt_assert_x("QUrl::errorString", "Cannot happen, unknown error",__FILE__,40074012) : qt_noop());-
2083 do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,40084013) : qt_noop()); __builtin_unreachable(); } while (0);-
2084 return QString();-
2085}-
2086-
2087static inline void appendComponentIfPresent(QString &msg, bool present, const char *componentName,-
2088 const QString &component)-
2089{-
2090 if (present) {-
2091 msg += QLatin1String(componentName);-
2092 msg += QLatin1Char('"');-
2093 msg += component;-
2094 msg += QLatin1String("\",");-
2095 }-
2096}-
2097QString QUrl::errorString() const-
2098{-
2099 QString msg;-
2100 if (!d
!dDescription
TRUEevaluated 130 times by 6 tests
Evaluated by:
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkRequest
  • tst_QTextDocument
  • tst_QUrl
  • tst_selftests - unknown status
FALSEevaluated 213 times by 2 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QUrl
)
130-213
2101 return
executed 130 times by 6 tests: return msg;
Executed by:
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkRequest
  • tst_QTextDocument
  • tst_QUrl
  • tst_selftests - unknown status
QString();msg;
executed 130 times by 6 tests: return msg;
Executed by:
  • tst_QMetaType
  • tst_QNetworkCacheMetaData
  • tst_QNetworkRequest
  • tst_QTextDocument
  • tst_QUrl
  • tst_selftests - unknown status
130
2102-
2103 QString errorSource;-
2104 int errorPosition = 0;-
2105 QUrlPrivate::ErrorCode errorCode = d->validityError(&errorSource, &errorPosition);-
2106 if (errorCode == QUrlPrivate::NoError
errorCode == Q...ivate::NoErrorDescription
TRUEevaluated 11 times by 2 tests
Evaluated by:
  • tst_QNetworkCacheMetaData
  • tst_QUrl
FALSEevaluated 202 times by 1 test
Evaluated by:
  • tst_QUrl
)
11-202
2107 return
executed 11 times by 2 tests: return msg;
Executed by:
  • tst_QNetworkCacheMetaData
  • tst_QUrl
QString();msg;
executed 11 times by 2 tests: return msg;
Executed by:
  • tst_QNetworkCacheMetaData
  • tst_QUrl
11
2108-
2109 QString msg =+= errorMessage(errorCode, errorSource, errorPosition);-
2110 msg += QLatin1String("; source was \"");-
2111 msg += errorSource;-
2112 msg += QLatin1String("\";");-
2113 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::Scheme,-
2114 " scheme = ", d->scheme);-
2115 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::UserInfo,-
2116 " userinfo = ", userInfo());-
2117 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::Host,-
2118 " host = ", d->host);-
2119 appendComponentIfPresent(msg, d->port != -1,-
2120 " port = ", QString::number(d->port));-
2121 appendComponentIfPresent(msg, !d->path.isEmpty(),-
2122 " path = ", d->path);-
2123 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::Query,-
2124 " query = ", d->query);-
2125 appendComponentIfPresent(msg, d->sectionIsPresent & QUrlPrivate::Fragment,-
2126 " fragment = ", d->fragment);-
2127 if (msg.endsWith(QLatin1Char(','))
msg.endsWith(QLatin1Char(','))Description
TRUEevaluated 201 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
)
1-201
2128 msg.chop(1);
executed 201 times by 1 test: msg.chop(1);
Executed by:
  • tst_QUrl
201
2129 return
executed 202 times by 1 test: return msg;
Executed by:
  • tst_QUrl
msg;
executed 202 times by 1 test: return msg;
Executed by:
  • tst_QUrl
202
2130}-
2131-
2132-
2133-
2134-
2135-
2136-
2137QStringList QUrl::toStringList(const QList<QUrl> &urls, FormattingOptions options)-
2138{-
2139 QStringList lst;-
2140 lst.reserve(urls.size());-
2141 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(urls)>::type> _container_((urls)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QUrl &url = *_container_.i; _container_.control; _container_.control =: 0urls)-
2142 lst.append(url.toString(options));
executed 465 times by 5 tests: lst.append(url.toString(options));
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QUrl
  • tst_languageChange
465
2143 return
executed 235 times by 5 tests: return lst;
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QUrl
  • tst_languageChange
lst;
executed 235 times by 5 tests: return lst;
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QUrl
  • tst_languageChange
235
2144-
2145}-
2146-
2147-
2148-
2149-
2150-
2151-
2152-
2153QList<QUrl> QUrl::fromStringList(const QStringList &urls, ParsingMode mode)-
2154{-
2155 QList<QUrl> lst;-
2156 lst.reserve(urls.size());-
2157 for (QForeachContainer<typename QtPrivate::remove_reference<decltype(urls)>::type> _container_((urls)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QString &str = *_container_.i; _container_.control; _container_.control =: 0urls) {-
2158 lst.append(QUrl(str, mode));
executed 507 times by 5 tests: lst.append(QUrl(str, mode));
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QUrl
  • tst_languageChange
507
}
executed 507 times by 5 tests: lst.append(QUrl(str, mode));
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QUrl
  • tst_languageChange
2159 return
executed 255 times by 5 tests: return lst;
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QUrl
  • tst_languageChange
lst;
executed 255 times by 5 tests: return lst;
Executed by:
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QUrl
  • tst_languageChange
255
2160}-
2161uint qHash(const QUrl &url, uint seed) noexcept-
2162{-
2163 if (!url.d
!url.dDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QUrl
)
3-7
2164 return
executed 3 times by 1 test: return qHash(-1, seed);
Executed by:
  • tst_QUrl
qHash(-1, seed);
executed 3 times by 1 test: return qHash(-1, seed);
Executed by:
  • tst_QUrl
3
2165-
2166 return
executed 7 times by 1 test: return qHash(url.d->scheme) ^ qHash(url.d->userName) ^ qHash(url.d->password) ^ qHash(url.d->host) ^ qHash(url.d->port, seed) ^ qHash(url.d->path) ^ qHash(url.d->query) ^ qHash(url.d->fragment);
Executed by:
  • tst_QUrl
qHash(url.d->scheme) ^
executed 7 times by 1 test: return qHash(url.d->scheme) ^ qHash(url.d->userName) ^ qHash(url.d->password) ^ qHash(url.d->host) ^ qHash(url.d->port, seed) ^ qHash(url.d->path) ^ qHash(url.d->query) ^ qHash(url.d->fragment);
Executed by:
  • tst_QUrl
7
2167 qHash(url.d->userName) ^
executed 7 times by 1 test: return qHash(url.d->scheme) ^ qHash(url.d->userName) ^ qHash(url.d->password) ^ qHash(url.d->host) ^ qHash(url.d->port, seed) ^ qHash(url.d->path) ^ qHash(url.d->query) ^ qHash(url.d->fragment);
Executed by:
  • tst_QUrl
7
2168 qHash(url.d->password) ^
executed 7 times by 1 test: return qHash(url.d->scheme) ^ qHash(url.d->userName) ^ qHash(url.d->password) ^ qHash(url.d->host) ^ qHash(url.d->port, seed) ^ qHash(url.d->path) ^ qHash(url.d->query) ^ qHash(url.d->fragment);
Executed by:
  • tst_QUrl
7
2169 qHash(url.d->host) ^
executed 7 times by 1 test: return qHash(url.d->scheme) ^ qHash(url.d->userName) ^ qHash(url.d->password) ^ qHash(url.d->host) ^ qHash(url.d->port, seed) ^ qHash(url.d->path) ^ qHash(url.d->query) ^ qHash(url.d->fragment);
Executed by:
  • tst_QUrl
7
2170 qHash(url.d->port, seed) ^
executed 7 times by 1 test: return qHash(url.d->scheme) ^ qHash(url.d->userName) ^ qHash(url.d->password) ^ qHash(url.d->host) ^ qHash(url.d->port, seed) ^ qHash(url.d->path) ^ qHash(url.d->query) ^ qHash(url.d->fragment);
Executed by:
  • tst_QUrl
7
2171 qHash(url.d->path) ^
executed 7 times by 1 test: return qHash(url.d->scheme) ^ qHash(url.d->userName) ^ qHash(url.d->password) ^ qHash(url.d->host) ^ qHash(url.d->port, seed) ^ qHash(url.d->path) ^ qHash(url.d->query) ^ qHash(url.d->fragment);
Executed by:
  • tst_QUrl
7
2172 qHash(url.d->query) ^
executed 7 times by 1 test: return qHash(url.d->scheme) ^ qHash(url.d->userName) ^ qHash(url.d->password) ^ qHash(url.d->host) ^ qHash(url.d->port, seed) ^ qHash(url.d->path) ^ qHash(url.d->query) ^ qHash(url.d->fragment);
Executed by:
  • tst_QUrl
7
2173 qHash(url.d->fragment);
executed 7 times by 1 test: return qHash(url.d->scheme) ^ qHash(url.d->userName) ^ qHash(url.d->password) ^ qHash(url.d->host) ^ qHash(url.d->port, seed) ^ qHash(url.d->path) ^ qHash(url.d->query) ^ qHash(url.d->fragment);
Executed by:
  • tst_QUrl
7
2174}-
2175-
2176static QUrl adjustFtpPath(QUrl url)-
2177{-
2178 if (url.scheme() == ftpScheme()) {-
2179 QString path = url.path(QUrl::PrettyDecoded);-
2180 if (path.startsWith(QLatin1String("//")))-
2181 url.setPath(QLatin1String("/%2F") + path.midRef(2), QUrl::TolerantMode);-
2182 }-
2183 return url;-
2184}-
2185-
2186static bool isIp6(const QString &text)-
2187{-
2188 QIPAddressUtils::IPv6Address address;-
2189 return !text.isEmpty() && QIPAddressUtils::parseIp6(address, text.begin(), text.end()) == 0;-
2190}-
2191QUrl QUrl::fromUserInput(const QString &userInput, const QString &workingDirectory,-
2192 UserInputResolutionOptions options)-
2193{-
2194 QString trimmedString = userInput.trimmed();-
2195-
2196 if (trimmedString.isEmpty())-
2197 return QUrl();-
2198-
2199-
2200-
2201-
2202 if (isIp6(trimmedString)) {-
2203 QUrl url;-
2204 url.setHost(trimmedString);-
2205 url.setScheme(([]() -> QString { enum { Size = sizeof(u"" "http")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "http" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()));-
2206 return url;-
2207 }-
2208-
2209 QUrl url = QUrl(trimmedString, QUrl::TolerantMode);-
2210-
2211 if (url.isRelative() && !QDir::isAbsolutePath(trimmedString)) {-
2212 QFileInfo fileInfo(QDir(workingDirectory), trimmedString);-
2213 if ((options & AssumeLocalFile) || fileInfo.exists())-
2214 return QUrl::fromLocalFile(fileInfo.absoluteFilePath());-
2215 }-
2216-
2217 return fromUserInput(trimmedString);-
2218}-
2219QUrl QUrl::fromUserInput(const QString &userInput)-
2220{-
2221 QString trimmedString = userInput.trimmed();-
2222-
2223-
2224-
2225 if (isIp6(trimmedString)
isIp6(trimmedString)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 54 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
) {
6-54
2226 QUrl url;-
2227 url.setHost(trimmedString);-
2228 url.setScheme(([]() -> QString { enum { Size = sizeof(u"" "http")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "http" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }()));-
2229 return
executed 6 times by 1 test: return url;
Executed by:
  • tst_QUrl
url;
executed 6 times by 1 test: return url;
Executed by:
  • tst_QUrl
6
2230 }-
2231-
2232-
2233 if (QDir::isAbsolutePath(trimmedString)
QDir::isAbsolu...trimmedString)Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 35 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
)
19-35
2234 return
executed 19 times by 1 test: return QUrl::fromLocalFile(trimmedString);
Executed by:
  • tst_QUrl
QUrl::fromLocalFile(trimmedString);
executed 19 times by 1 test: return QUrl::fromLocalFile(trimmedString);
Executed by:
  • tst_QUrl
19
2235-
2236 QUrl url = QUrl(trimmedString, QUrl::TolerantMode);-
2237 QUrl urlPrepended = QUrl(([]() -> QString { enum { Size = sizeof(u"" "http://")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeofQLatin1String(QStringData) }, u"" "http://"}; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }())) + trimmedString, QUrl::TolerantMode);-
2238-
2239-
2240-
2241-
2242 if (url.isValid()
url.isValid()Description
TRUEevaluated 34 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
1-34
2243 && !url.scheme().isEmpty()
!url.scheme().isEmpty()Description
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_QUrl
16-18
2244 && urlPrepended.port() == -1
urlPrepended.port() == -1Description
TRUEevaluated 15 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_QUrl
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QUrl
)
3-15
2245 return
executed 15 times by 2 tests: return adjustFtpPath(url);
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
adjustFtpPath(url);
executed 15 times by 2 tests: return adjustFtpPath(url);
Executed by:
  • tst_QNetworkReply
  • tst_QUrl
15
2246-
2247-
2248 if (urlPrepended.isValid()
urlPrepended.isValid()Description
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEnever evaluated
&& (!urlPrepended.host().isEmpty()
!urlPrepended.host().isEmpty()Description
TRUEevaluated 19 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
|| !urlPrepended.path().isEmpty()
!urlPrepended.path().isEmpty()Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QUrl
))
0-20
2249 {-
2250 int dotIndex = trimmedString.indexOf(QLatin1Char('.'));-
2251 const QString hostscheme = trimmedString.left(dotIndex).toLower();-
2252 if (hostscheme == ftpScheme()
hostscheme == ftpScheme()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QUrl
FALSEevaluated 17 times by 1 test
Evaluated by:
  • tst_QUrl
)
2-17
2253 urlPrepended.setScheme(ftpScheme());
executed 2 times by 1 test: urlPrepended.setScheme(ftpScheme());
Executed by:
  • tst_QUrl
2
2254 return
executed 19 times by 1 test: return adjustFtpPath(urlPrepended);
Executed by:
  • tst_QUrl
adjustFtpPath(urlPrepended);
executed 19 times by 1 test: return adjustFtpPath(urlPrepended);
Executed by:
  • tst_QUrl
19
2255 }-
2256-
2257 return
executed 1 time by 1 test: return QUrl();
Executed by:
  • tst_QUrl
QUrl();
executed 1 time by 1 test: return QUrl();
Executed by:
  • tst_QUrl
1
2258}-
2259-
2260-
2261-
Switch to Source codePreprocessed file

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