Qt 4.8
Classes | Macros | Enumerations | Functions | Variables
qurl.cpp File Reference
#include "qplatformdefs.h"
#include "qurl.h"
#include "qatomic.h"
#include "qbytearray.h"
#include "qdir.h"
#include "qfile.h"
#include "qlist.h"
#include "qregexp.h"
#include "qstring.h"
#include "qstringlist.h"
#include "qstack.h"
#include "qvarlengtharray.h"
#include "qdebug.h"
#include "qtldurl_p.h"
#include "qmutex.h"
#include "private/qorderedmutexlocker_p.h"

Go to the source code of this file.

Classes

struct  NameprepCaseFoldingEntry
 
struct  QUrlErrorInfo
 
struct  QUrlParseData
 
class  QUrlPrivate
 

Macros

#define ABNF_gen_delims   ":/?#[]@"
 
#define ABNF_pchar   ABNF_sub_delims ":@"
 
#define ABNF_reserved   ABNF_sub_delims ABNF_gen_delims
 
#define ABNF_sub_delims   "!$&'()*+,;="
 
#define Q_MAXINT   ((uint)((uint)(-1)>>1))
 
#define qToLower(ch)   (((ch|32) >= 'a' && (ch|32) <= 'z') ? (ch|32) : ch)
 
#define QURL_HASFLAG(a, b)   (((a) & (b)) == (b))
 
#define QURL_SETFLAG(a, b)   { (a) |= (b); }
 
#define QURL_UNSETFLAG(a, b)   { (a) &= ~(b); }
 

Enumerations

enum  AceOperation { ToAceOnly, NormalizeAce }
 

Functions

static void QT_FASTCALL _authority (const char **ptr, QUrlParseData *parseData)
 
static bool QT_FASTCALL _decOctet (const char **ptr)
 
static void QT_FASTCALL _fragment (const char **ptr, QUrlParseData *parseData)
 
static bool QT_FASTCALL _h16 (const char **ptr)
 
static bool QT_FASTCALL _HEXDIG (const char **ptr)
 
static void QT_FASTCALL _hierPart (const char **ptr, QUrlParseData *parseData)
 
static void QT_FASTCALL _host (const char **ptr, QUrlParseData *parseData)
 
static bool QT_FASTCALL _IPLiteral (const char **ptr)
 
static bool QT_FASTCALL _IPv4Address (const char **ptr)
 
static bool QT_FASTCALL _IPv6Address (const char **ptr)
 
static bool QT_FASTCALL _IPvFuture (const char **ptr)
 
static bool QT_FASTCALL _ls32 (const char **ptr)
 
static void QT_FASTCALL _pathAbEmpty (const char **ptr)
 
static bool QT_FASTCALL _pathAbs (const char **ptr)
 
static bool QT_FASTCALL _pathRootless (const char **ptr)
 
static bool QT_FASTCALL _pchar (const char **ptr)
 
static bool QT_FASTCALL _pctEncoded (const char **ptr)
 
static void QT_FASTCALL _port (const char **ptr, int *port)
 
static void QT_FASTCALL _query (const char **ptr, QUrlParseData *parseData)
 
static void QT_FASTCALL _regName (const char **ptr)
 
static bool QT_FASTCALL _scheme (const char **ptr, QUrlParseData *parseData)
 
static bool QT_FASTCALL _segmentNZ (const char **ptr)
 
static bool QT_FASTCALL _subDelims (const char **ptr)
 
static bool QT_FASTCALL _unreserved (const char **ptr)
 
static void QT_FASTCALL _userInfo (const char **ptr, QUrlParseData *parseData)
 
static uint adapt (uint delta, uint numpoints, bool firsttime)
 
static void appendEncode (QString *output, uint &delta, uint &bias, uint &b, uint &h)
 
static bool containsProhibitedOuptut (const QString *str, int from)
 
static uint encodeDigit (uint digit)
 
static bool equal (const QChar *a, int l, const char *b)
 
static QString fromPercentEncodingHelper (const QByteArray &ba)
 
static QString fromPercentEncodingMutable (QByteArray *ba)
 
static bool isBidirectionalL (uint uc)
 
static bool isBidirectionalRorAL (uint uc)
 
static bool isDotDelimiter (ushort uc)
 
static bool isHex (char c)
 
static bool isMappedToNothing (uint uc)
 
static bool lessThan (const QChar *a, int l, const char *c)
 
static void mapToLowerCase (QString *str, int from)
 
static int nextDotDelimiter (const QString &domain, int from=0)
 
bool operator< (uint one, const NameprepCaseFoldingEntry &other)
 
bool operator< (const NameprepCaseFoldingEntry &one, uint other)
 
QDebug operator<< (QDebug d, const QUrl &url)
 
void q_fromPercentEncoding (QByteArray *ba)
 
void q_normalizePercentEncoding (QByteArray *ba, const char *exclude)
 
void q_toPercentEncoding (QByteArray *ba, const char *exclude, const char *include=0)
 
Q_CORE_EXPORT int qsnprintf (char *str, size_t n, const char *fmt,...)
 
static QString qt_ACE_do (const QString &domain, AceOperation op)
 
static bool qt_check_std3rules (const QChar *uc, int len)
 
static bool qt_is_idn_enabled (const QString &domain)
 
static void qt_nameprep (QString *source, int from)
 
static void removeDotsFromPath (QByteArray *path)
 
static char toHex (quint8 c)
 
static QByteArray toPercentEncodingHelper (const QString &s, const char *exclude, const char *include=0)
 
static void toPunycodeHelper (const QChar *s, int ucLength, QString *output)
 

Variables

static const uint base = 36
 
static const uint damp = 700
 
static const char fragmentExcludeChars [] = ABNF_pchar "/?"
 
static const char *const idn_whitelist []
 
static const uint initial_bias = 72
 
static const uint initial_n = 128
 
static const NameprepCaseFoldingEntry NameprepCaseFolding []
 
static const char passwordExcludeChars [] = ABNF_sub_delims ":"
 
static const char pathExcludeChars [] = ABNF_pchar "/"
 
static const char queryExcludeChars [] = ABNF_pchar "/?"
 
static const uint skew = 38
 
static const uint tmax = 26
 
static const uint tmin = 1
 
static QStringListuser_idn_whitelist = 0
 
static const char userNameExcludeChars [] = ABNF_sub_delims
 

Macro Definition Documentation

◆ ABNF_gen_delims

#define ABNF_gen_delims   ":/?#[]@"

Definition at line 3535 of file qurl.cpp.

◆ ABNF_pchar

#define ABNF_pchar   ABNF_sub_delims ":@"

Definition at line 3536 of file qurl.cpp.

◆ ABNF_reserved

#define ABNF_reserved   ABNF_sub_delims ABNF_gen_delims

Definition at line 3537 of file qurl.cpp.

Referenced by QUrl::setUrl().

◆ ABNF_sub_delims

#define ABNF_sub_delims   "!$&'()*+,;="

Definition at line 3534 of file qurl.cpp.

◆ Q_MAXINT

#define Q_MAXINT   ((uint)((uint)(-1)>>1))

Definition at line 267 of file qurl.cpp.

Referenced by QUrl::fromPunycode(), and toPunycodeHelper().

◆ qToLower

#define qToLower (   ch)    (((ch|32) >= 'a' && (ch|32) <= 'z') ? (ch|32) : ch)

Definition at line 4080 of file qurl.cpp.

Referenced by QUrlPrivate::normalized().

◆ QURL_HASFLAG

#define QURL_HASFLAG (   a,
 
)    (((a) & (b)) == (b))

◆ QURL_SETFLAG

#define QURL_SETFLAG (   a,
 
)    { (a) |= (b); }

◆ QURL_UNSETFLAG

#define QURL_UNSETFLAG (   a,
 
)    { (a) &= ~(b); }

Enumeration Type Documentation

◆ AceOperation

Enumerator
ToAceOnly 
NormalizeAce 

Definition at line 3333 of file qurl.cpp.

Function Documentation

◆ _authority()

static void QT_FASTCALL _authority ( const char **  ptr,
QUrlParseData parseData 
)
static

Definition at line 856 of file qurl.cpp.

Referenced by _hierPart().

857 {
858  _userInfo(ptr, parseData);
859  _host(ptr, parseData);
860 
861  if (**ptr != ':')
862  return;
863 
864  ++(*ptr);
865  _port(ptr, &parseData->port);
866 }
static void QT_FASTCALL _port(const char **ptr, int *port)
Definition: qurl.cpp:833
const T * ptr(const T &t)
static void QT_FASTCALL _host(const char **ptr, QUrlParseData *parseData)
Definition: qurl.cpp:787
static void QT_FASTCALL _userInfo(const char **ptr, QUrlParseData *parseData)
Definition: qurl.cpp:806

◆ _decOctet()

static bool QT_FASTCALL _decOctet ( const char **  ptr)
static

Definition at line 567 of file qurl.cpp.

Referenced by _IPv4Address().

568 {
569  const char *ptrBackup = *ptr;
570  char c1 = **ptr;
571 
572  if (c1 < '0' || c1 > '9')
573  return false;
574 
575  ++(*ptr);
576 
577  if (c1 == '0')
578  return true;
579 
580  char c2 = **ptr;
581 
582  if (c2 < '0' || c2 > '9')
583  return true;
584 
585  ++(*ptr);
586 
587  char c3 = **ptr;
588  if (c3 < '0' || c3 > '9')
589  return true;
590 
591  // If there is a three digit number larger than 255, reject the
592  // whole token.
593  if (c1 >= '2' && c2 >= '5' && c3 > '5') {
594  *ptr = ptrBackup;
595  return false;
596  }
597 
598  ++(*ptr);
599 
600  return true;
601 }
const T * ptr(const T &t)

◆ _fragment()

static void QT_FASTCALL _fragment ( const char **  ptr,
QUrlParseData parseData 
)
static

Definition at line 988 of file qurl.cpp.

Referenced by QUrlPrivate::parse().

989 {
990  parseData->fragment = *ptr;
991  for (;;) {
992  if (_pchar(ptr)) {
993  ;
994  } else if (**ptr == '/' || **ptr == '?' || **ptr == '#') {
995  ++(*ptr);
996  } else {
997  break;
998  }
999  }
1000  parseData->fragmentLength = *ptr - parseData->fragment;
1001 }
int fragmentLength
Definition: qurl.cpp:316
const char * fragment
Definition: qurl.cpp:315
const T * ptr(const T &t)
static bool QT_FASTCALL _pchar(const char **ptr)
Definition: qurl.cpp:869

◆ _h16()

static bool QT_FASTCALL _h16 ( const char **  ptr)
static

Definition at line 552 of file qurl.cpp.

Referenced by _IPv6Address(), and _ls32().

553 {
554  int i = 0;
555  for (; i < 4; ++i) {
556  if (!_HEXDIG(ptr))
557  break;
558  }
559  return (i != 0);
560 }
static bool QT_FASTCALL _HEXDIG(const char **ptr)
Definition: qurl.cpp:404
const T * ptr(const T &t)

◆ _HEXDIG()

static bool QT_FASTCALL _HEXDIG ( const char **  ptr)
static

Definition at line 404 of file qurl.cpp.

Referenced by _h16(), _IPvFuture(), and _pctEncoded().

405 {
406  char ch = **ptr;
407  if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F')) {
408  ++(*ptr);
409  return true;
410  }
411 
412  return false;
413 }
const T * ptr(const T &t)

◆ _hierPart()

static void QT_FASTCALL _hierPart ( const char **  ptr,
QUrlParseData parseData 
)
static

Definition at line 951 of file qurl.cpp.

Referenced by QUrlPrivate::parse().

952 {
953  const char *ptrBackup = *ptr;
954  const char *pathStart = 0;
955  if (*((*ptr)++) == '/' && *((*ptr)++) == '/') {
956  _authority(ptr, parseData);
957  pathStart = *ptr;
958  _pathAbEmpty(ptr);
959  } else {
960  *ptr = ptrBackup;
961  pathStart = *ptr;
962  if (**ptr == '/')
963  _pathAbs(ptr);
964  else
966  }
967  parseData->path = pathStart;
968  parseData->pathLength = *ptr - pathStart;
969 }
const char * path
Definition: qurl.cpp:311
static bool QT_FASTCALL _pathAbs(const char **ptr)
Definition: qurl.cpp:920
const T * ptr(const T &t)
int pathLength
Definition: qurl.cpp:312
static void QT_FASTCALL _authority(const char **ptr, QUrlParseData *parseData)
Definition: qurl.cpp:856
static void QT_FASTCALL _pathAbEmpty(const char **ptr)
Definition: qurl.cpp:907
static bool QT_FASTCALL _pathRootless(const char **ptr)
Definition: qurl.cpp:935

◆ _host()

static void QT_FASTCALL _host ( const char **  ptr,
QUrlParseData parseData 
)
static

Definition at line 787 of file qurl.cpp.

Referenced by _authority().

788 {
789  parseData->host = *ptr;
790  if (!_IPLiteral(ptr)) {
791  if (_IPv4Address(ptr)) {
792  char ch = **ptr;
793  if (ch && ch != ':' && ch != '/') {
794  // reset
795  *ptr = parseData->host;
796  _regName(ptr);
797  }
798  } else {
799  _regName(ptr);
800  }
801  }
802  parseData->hostLength = *ptr - parseData->host;
803 }
static bool QT_FASTCALL _IPv4Address(const char **ptr)
Definition: qurl.cpp:604
static bool QT_FASTCALL _IPLiteral(const char **ptr)
Definition: qurl.cpp:754
const T * ptr(const T &t)
const char * host
Definition: qurl.cpp:307
static void QT_FASTCALL _regName(const char **ptr)
Definition: qurl.cpp:776
int hostLength
Definition: qurl.cpp:308

◆ _IPLiteral()

static bool QT_FASTCALL _IPLiteral ( const char **  ptr)
static

Definition at line 754 of file qurl.cpp.

Referenced by _host(), and QUrlPrivate::canonicalHost().

755 {
756  const char *ptrBackup = *ptr;
757  if (**ptr != '[')
758  return false;
759  ++(*ptr);
760 
761  if (!_IPv6Address(ptr) && !_IPvFuture(ptr)) {
762  *ptr = ptrBackup;
763  return false;
764  }
765 
766  if (**ptr != ']') {
767  *ptr = ptrBackup;
768  return false;
769  }
770  ++(*ptr);
771 
772  return true;
773 }
static bool QT_FASTCALL _IPvFuture(const char **ptr)
Definition: qurl.cpp:516
const T * ptr(const T &t)
static bool QT_FASTCALL _IPv6Address(const char **ptr)
Definition: qurl.cpp:650

◆ _IPv4Address()

static bool QT_FASTCALL _IPv4Address ( const char **  ptr)
static

Definition at line 604 of file qurl.cpp.

Referenced by _host(), and _ls32().

605 {
606  const char *ptrBackup = *ptr;
607 
608  if (!_decOctet(ptr)) {
609  *ptr = ptrBackup;
610  return false;
611  }
612 
613  for (int i = 0; i < 3; ++i) {
614  char ch = *((*ptr)++);
615  if (ch != '.') {
616  *ptr = ptrBackup;
617  return false;
618  }
619 
620  if (!_decOctet(ptr)) {
621  *ptr = ptrBackup;
622  return false;
623  }
624  }
625 
626  return true;
627 }
const T * ptr(const T &t)
static bool QT_FASTCALL _decOctet(const char **ptr)
Definition: qurl.cpp:567

◆ _IPv6Address()

static bool QT_FASTCALL _IPv6Address ( const char **  ptr)
static

Definition at line 650 of file qurl.cpp.

Referenced by _IPLiteral().

651 {
652  const char *ptrBackup = *ptr;
653 
654  // count of (h16 ":") to the left of and including ::
655  int leftHexColons = 0;
656  // count of (h16 ":") to the right of ::
657  int rightHexColons = 0;
658 
659  // first count the number of (h16 ":") on the left of ::
660  while (_h16(ptr)) {
661 
662  // an h16 not followed by a colon is considered an
663  // error.
664  if (**ptr != ':') {
665  *ptr = ptrBackup;
666  return false;
667  }
668  ++(*ptr);
669  ++leftHexColons;
670 
671  // check for case 1, the only time when there can be no ::
672  if (leftHexColons == 6 && _ls32(ptr)) {
673  return true;
674  }
675  }
676 
677  // check for case 2 where the address starts with a :
678  if (leftHexColons == 0 && *((*ptr)++) != ':') {
679  *ptr = ptrBackup;
680  return false;
681  }
682 
683  // check for the second colon in ::
684  if (*((*ptr)++) != ':') {
685  *ptr = ptrBackup;
686  return false;
687  }
688 
689  int canBeCase = -1;
690  bool ls32WasRead = false;
691 
692  const char *tmpBackup = *ptr;
693 
694  // count the number of (h16 ":") on the right of ::
695  for (;;) {
696  tmpBackup = *ptr;
697  if (!_h16(ptr)) {
698  if (!_ls32(ptr)) {
699  if (rightHexColons != 0) {
700  *ptr = ptrBackup;
701  return false;
702  }
703 
704  // the address ended with :: (case 9)
705  // only valid if 1 <= leftHexColons <= 7
706  canBeCase = 9;
707  } else {
708  ls32WasRead = true;
709  }
710  break;
711  }
712  ++rightHexColons;
713  if (**ptr != ':') {
714  // no colon could mean that what was read as an h16
715  // was in fact the first part of an ls32. we backtrack
716  // and retry.
717  const char *pb = *ptr;
718  *ptr = tmpBackup;
719  if (_ls32(ptr)) {
720  ls32WasRead = true;
721  --rightHexColons;
722  } else {
723  *ptr = pb;
724  // address ends with only 1 h16 after :: (case 8)
725  if (rightHexColons == 1)
726  canBeCase = 8;
727  }
728  break;
729  }
730  ++(*ptr);
731  }
732 
733  // determine which case it is based on the number of rightHexColons
734  if (canBeCase == -1) {
735 
736  // check if a ls32 was read. If it wasn't and rightHexColons >= 2 then the
737  // last 2 HexColons are in fact a ls32
738  if (!ls32WasRead && rightHexColons >= 2)
739  rightHexColons -= 2;
740 
741  canBeCase = 7 - rightHexColons;
742  }
743 
744  // based on the case we need to check that the number of leftHexColons is valid
745  if (leftHexColons > (canBeCase - 2)) {
746  *ptr = ptrBackup;
747  return false;
748  }
749 
750  return true;
751 }
static bool QT_FASTCALL _h16(const char **ptr)
Definition: qurl.cpp:552
const T * ptr(const T &t)
static bool QT_FASTCALL _ls32(const char **ptr)
Definition: qurl.cpp:631

◆ _IPvFuture()

static bool QT_FASTCALL _IPvFuture ( const char **  ptr)
static

Definition at line 516 of file qurl.cpp.

Referenced by _IPLiteral().

517 {
518  if (**ptr != 'v')
519  return false;
520 
521  const char *ptrBackup = *ptr;
522  ++(*ptr);
523 
524  if (!_HEXDIG(ptr)) {
525  *ptr = ptrBackup;
526  return false;
527  }
528 
529  while (_HEXDIG(ptr))
530  ;
531 
532  if (**ptr != '.') {
533  *ptr = ptrBackup;
534  return false;
535  }
536  ++(*ptr);
537 
538  if (!_unreserved(ptr) && !_subDelims(ptr) && *((*ptr)++) != ':') {
539  *ptr = ptrBackup;
540  return false;
541  }
542 
543 
544  while (_unreserved(ptr) || _subDelims(ptr) || *((*ptr)++) == ':')
545  ;
546 
547  return true;
548 }
static bool QT_FASTCALL _subDelims(const char **ptr)
Definition: qurl.cpp:455
static bool QT_FASTCALL _HEXDIG(const char **ptr)
Definition: qurl.cpp:404
const T * ptr(const T &t)
static bool QT_FASTCALL _unreserved(const char **ptr)
Definition: qurl.cpp:470

◆ _ls32()

static bool QT_FASTCALL _ls32 ( const char **  ptr)
static

Definition at line 631 of file qurl.cpp.

Referenced by _IPv6Address().

632 {
633  const char *ptrBackup = *ptr;
634  if (_h16(ptr) && *((*ptr)++) == ':' && _h16(ptr))
635  return true;
636 
637  *ptr = ptrBackup;
638  return _IPv4Address(ptr);
639 }
static bool QT_FASTCALL _IPv4Address(const char **ptr)
Definition: qurl.cpp:604
static bool QT_FASTCALL _h16(const char **ptr)
Definition: qurl.cpp:552
const T * ptr(const T &t)

◆ _pathAbEmpty()

static void QT_FASTCALL _pathAbEmpty ( const char **  ptr)
static

Definition at line 907 of file qurl.cpp.

Referenced by _hierPart(), _pathAbs(), and _pathRootless().

908 {
909  for (;;) {
910  if (**ptr != '/')
911  break;
912  ++(*ptr);
913 
914  while (_pchar(ptr))
915  ;
916  }
917 }
const T * ptr(const T &t)
static bool QT_FASTCALL _pchar(const char **ptr)
Definition: qurl.cpp:869

◆ _pathAbs()

static bool QT_FASTCALL _pathAbs ( const char **  ptr)
static

Definition at line 920 of file qurl.cpp.

Referenced by _hierPart().

921 {
922  // **ptr == '/' already checked in caller
923  ++(*ptr);
924 
925  // we might be able to unnest this to gain some performance.
926  if (!_segmentNZ(ptr))
927  return true;
928 
929  _pathAbEmpty(ptr);
930 
931  return true;
932 }
const T * ptr(const T &t)
static void QT_FASTCALL _pathAbEmpty(const char **ptr)
Definition: qurl.cpp:907
static bool QT_FASTCALL _segmentNZ(const char **ptr)
Definition: qurl.cpp:895

◆ _pathRootless()

static bool QT_FASTCALL _pathRootless ( const char **  ptr)
static

Definition at line 935 of file qurl.cpp.

Referenced by _hierPart().

936 {
937  // we might be able to unnest this to gain some performance.
938  if (!_segmentNZ(ptr))
939  return false;
940 
941  _pathAbEmpty(ptr);
942 
943  return true;
944 }
const T * ptr(const T &t)
static void QT_FASTCALL _pathAbEmpty(const char **ptr)
Definition: qurl.cpp:907
static bool QT_FASTCALL _segmentNZ(const char **ptr)
Definition: qurl.cpp:895

◆ _pchar()

static bool QT_FASTCALL _pchar ( const char **  ptr)
static

Definition at line 869 of file qurl.cpp.

Referenced by _fragment(), _pathAbEmpty(), _query(), and _segmentNZ().

870 {
871  char c = *(*ptr);
872 
873  switch (c) {
874  case '!': case '$': case '&': case '\'': case '(': case ')': case '*':
875  case '+': case ',': case ';': case '=': case ':': case '@':
876  case '-': case '.': case '_': case '~':
877  ++(*ptr);
878  return true;
879  default:
880  break;
881  };
882 
883  if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) {
884  ++(*ptr);
885  return true;
886  }
887 
888  if (_pctEncoded(ptr))
889  return true;
890 
891  return false;
892 }
unsigned char c[8]
Definition: qnumeric_p.h:62
static bool QT_FASTCALL _pctEncoded(const char **ptr)
Definition: qurl.cpp:416
const T * ptr(const T &t)

◆ _pctEncoded()

static bool QT_FASTCALL _pctEncoded ( const char **  ptr)
static

Definition at line 416 of file qurl.cpp.

Referenced by _pchar(), _regName(), and _userInfo().

417 {
418  const char *ptrBackup = *ptr;
419 
420  if (**ptr != '%')
421  return false;
422  ++(*ptr);
423 
424  if (!_HEXDIG(ptr)) {
425  *ptr = ptrBackup;
426  return false;
427  }
428  if (!_HEXDIG(ptr)) {
429  *ptr = ptrBackup;
430  return false;
431  }
432 
433  return true;
434 }
static bool QT_FASTCALL _HEXDIG(const char **ptr)
Definition: qurl.cpp:404
const T * ptr(const T &t)

◆ _port()

static void QT_FASTCALL _port ( const char **  ptr,
int *  port 
)
static

Definition at line 833 of file qurl.cpp.

Referenced by _authority().

834 {
835  bool first = true;
836 
837  for (;;) {
838  const char *ptrBackup = *ptr;
839  char ch = *((*ptr)++);
840  if (ch < '0' || ch > '9') {
841  *ptr = ptrBackup;
842  break;
843  }
844 
845  if (first) {
846  first = false;
847  *port = 0;
848  }
849 
850  *port *= 10;
851  *port += ch - '0';
852  }
853 }
const T * ptr(const T &t)

◆ _query()

static void QT_FASTCALL _query ( const char **  ptr,
QUrlParseData parseData 
)
static

Definition at line 972 of file qurl.cpp.

Referenced by QUrlPrivate::parse().

973 {
974  parseData->query = *ptr;
975  for (;;) {
976  if (_pchar(ptr)) {
977  ;
978  } else if (**ptr == '/' || **ptr == '?') {
979  ++(*ptr);
980  } else {
981  break;
982  }
983  }
984  parseData->queryLength = *ptr - parseData->query;
985 }
int queryLength
Definition: qurl.cpp:314
const T * ptr(const T &t)
static bool QT_FASTCALL _pchar(const char **ptr)
Definition: qurl.cpp:869
const char * query
Definition: qurl.cpp:313

◆ _regName()

static void QT_FASTCALL _regName ( const char **  ptr)
static

Definition at line 776 of file qurl.cpp.

Referenced by _host().

777 {
778  for (;;) {
779  if (!_unreserved(ptr) && !_subDelims(ptr)) {
780  if (!_pctEncoded(ptr))
781  break;
782  }
783  }
784 }
static bool QT_FASTCALL _subDelims(const char **ptr)
Definition: qurl.cpp:455
static bool QT_FASTCALL _pctEncoded(const char **ptr)
Definition: qurl.cpp:416
const T * ptr(const T &t)
static bool QT_FASTCALL _unreserved(const char **ptr)
Definition: qurl.cpp:470

◆ _scheme()

static bool QT_FASTCALL _scheme ( const char **  ptr,
QUrlParseData parseData 
)
static

Definition at line 483 of file qurl.cpp.

Referenced by QUrlPrivate::parse().

484 {
485  bool first = true;
486  bool isSchemeValid = true;
487 
488  parseData->scheme = *ptr;
489  for (;;) {
490  char ch = **ptr;
491  if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
492  ;
493  } else if ((ch >= '0' && ch <= '9') || ch == '+' || ch == '-' || ch == '.') {
494  if (first)
495  isSchemeValid = false;
496  } else {
497  break;
498  }
499 
500  ++(*ptr);
501  first = false;
502  }
503 
504  if (**ptr != ':') {
505  isSchemeValid = true;
506  *ptr = parseData->scheme;
507  } else {
508  parseData->schemeLength = *ptr - parseData->scheme;
509  ++(*ptr); // skip ':'
510  }
511 
512  return isSchemeValid;
513 }
const char * scheme
Definition: qurl.cpp:300
const T * ptr(const T &t)
int schemeLength
Definition: qurl.cpp:301

◆ _segmentNZ()

static bool QT_FASTCALL _segmentNZ ( const char **  ptr)
static

Definition at line 895 of file qurl.cpp.

Referenced by _pathAbs(), and _pathRootless().

896 {
897  if (!_pchar(ptr))
898  return false;
899 
900  while(_pchar(ptr))
901  ;
902 
903  return true;
904 }
const T * ptr(const T &t)
static bool QT_FASTCALL _pchar(const char **ptr)
Definition: qurl.cpp:869

◆ _subDelims()

static bool QT_FASTCALL _subDelims ( const char **  ptr)
static

Definition at line 455 of file qurl.cpp.

Referenced by _IPvFuture(), _regName(), and _userInfo().

456 {
457  char ch = **ptr;
458  switch (ch) {
459  case '!': case '$': case '&': case '\'':
460  case '(': case ')': case '*': case '+':
461  case ',': case ';': case '=':
462  ++(*ptr);
463  return true;
464  default:
465  return false;
466  }
467 }
const T * ptr(const T &t)

◆ _unreserved()

static bool QT_FASTCALL _unreserved ( const char **  ptr)
static

Definition at line 470 of file qurl.cpp.

Referenced by _IPvFuture(), _regName(), and _userInfo().

471 {
472  char ch = **ptr;
473  if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
474  || (ch >= '0' && ch <= '9')
475  || ch == '-' || ch == '.' || ch == '_' || ch == '~') {
476  ++(*ptr);
477  return true;
478  }
479  return false;
480 }
const T * ptr(const T &t)

◆ _userInfo()

static void QT_FASTCALL _userInfo ( const char **  ptr,
QUrlParseData parseData 
)
static

Definition at line 806 of file qurl.cpp.

Referenced by _authority().

807 {
808  parseData->userInfo = *ptr;
809  for (;;) {
810  if (_unreserved(ptr) || _subDelims(ptr)) {
811  ;
812  } else {
813  if (_pctEncoded(ptr)) {
814  ;
815  } else if (**ptr == ':') {
816  parseData->userInfoDelimIndex = *ptr - parseData->userInfo;
817  ++(*ptr);
818  } else {
819  break;
820  }
821  }
822  }
823  if (**ptr != '@') {
824  *ptr = parseData->userInfo;
825  parseData->userInfoDelimIndex = -1;
826  return;
827  }
828  parseData->userInfoLength = *ptr - parseData->userInfo;
829  ++(*ptr);
830 }
static bool QT_FASTCALL _subDelims(const char **ptr)
Definition: qurl.cpp:455
static bool QT_FASTCALL _pctEncoded(const char **ptr)
Definition: qurl.cpp:416
const char * userInfo
Definition: qurl.cpp:303
int userInfoLength
Definition: qurl.cpp:305
int userInfoDelimIndex
Definition: qurl.cpp:304
const T * ptr(const T &t)
static bool QT_FASTCALL _unreserved(const char **ptr)
Definition: qurl.cpp:470

◆ adapt()

static uint adapt ( uint  delta,
uint  numpoints,
bool  firsttime 
)
inlinestatic

Definition at line 3104 of file qurl.cpp.

Referenced by appendEncode(), and QUrl::fromPunycode().

3105 {
3106  delta /= (firsttime ? damp : 2);
3107  delta += (delta / numpoints);
3108 
3109  uint k = 0;
3110  for (; delta > ((base - tmin) * tmax) / 2; k += base)
3111  delta /= (base - tmin);
3112 
3113  return k + (((base - tmin + 1) * delta) / (delta + skew));
3114 }
static const uint skew
Definition: qurl.cpp:271
static const uint damp
Definition: qurl.cpp:272
static const uint tmin
Definition: qurl.cpp:269
static const uint base
Definition: qurl.cpp:268
static const uint tmax
Definition: qurl.cpp:270
unsigned int uint
Definition: qglobal.h:996

◆ appendEncode()

static void appendEncode ( QString output,
uint delta,
uint bias,
uint b,
uint h 
)
inlinestatic

Definition at line 3116 of file qurl.cpp.

Referenced by toPunycodeHelper().

3117 {
3118  uint qq;
3119  uint k;
3120  uint t;
3121 
3122  // insert the variable length delta integer; fail on
3123  // overflow.
3124  for (qq = delta, k = base;; k += base) {
3125  // stop generating digits when the threshold is
3126  // detected.
3127  t = (k <= bias) ? tmin : (k >= bias + tmax) ? tmax : k - bias;
3128  if (qq < t) break;
3129 
3130  *output += QChar(encodeDigit(t + (qq - t) % (base - t)));
3131  qq = (qq - t) / (base - t);
3132  }
3133 
3134  *output += QChar(encodeDigit(qq));
3135  bias = adapt(delta, h + 1, h == b);
3136  delta = 0;
3137  ++h;
3138 }
static const uint base
Definition: qurl.cpp:268
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
static const uint tmax
Definition: qurl.cpp:270
unsigned int uint
Definition: qglobal.h:996
static uint encodeDigit(uint digit)
Definition: qurl.cpp:3099
static uint adapt(uint delta, uint numpoints, bool firsttime)
Definition: qurl.cpp:3104

◆ containsProhibitedOuptut()

static bool containsProhibitedOuptut ( const QString str,
int  from 
)
static

Definition at line 2450 of file qurl.cpp.

Referenced by qt_nameprep().

2451 {
2452  const ushort *in = reinterpret_cast<const ushort *>(str->begin() + from);
2453  const ushort *end = (ushort *)str->data() + str->size();
2454  for ( ; in < end; ++in) {
2455  uint uc = *in;
2456  if (QChar(uc).isHighSurrogate() && in < end - 1) {
2457  ushort low = *(in + 1);
2458  if (QChar(low).isLowSurrogate()) {
2459  ++in;
2460  uc = QChar::surrogateToUcs4(uc, low);
2461  } else {
2462  // unpaired surrogates are prohibited
2463  return true;
2464  }
2465  }
2466  if (uc <= 0xFFFF) {
2467  if (uc < 0x80 ||
2468  !(uc <= 0x009F
2469  || uc == 0x00A0
2470  || uc == 0x0340
2471  || uc == 0x0341
2472  || uc == 0x06DD
2473  || uc == 0x070F
2474  || uc == 0x1680
2475  || uc == 0x180E
2476  || (uc >= 0x2000 && uc <= 0x200F)
2477  || (uc >= 0x2028 && uc <= 0x202F)
2478  || uc == 0x205F
2479  || (uc >= 0x2060 && uc <= 0x2063)
2480  || (uc >= 0x206A && uc <= 0x206F)
2481  || (uc >= 0x2FF0 && uc <= 0x2FFB)
2482  || uc == 0x3000
2483  || (uc >= 0xD800 && uc <= 0xDFFF)
2484  || (uc >= 0xE000 && uc <= 0xF8FF)
2485  || (uc >= 0xFDD0 && uc <= 0xFDEF)
2486  || uc == 0xFEFF
2487  || (uc >= 0xFFF9 && uc <= 0xFFFF))) {
2488  continue;
2489  }
2490  } else {
2491  if (!((uc >= 0x1D173 && uc <= 0x1D17A)
2492  || (uc >= 0x1FFFE && uc <= 0x1FFFF)
2493  || (uc >= 0x2FFFE && uc <= 0x2FFFF)
2494  || (uc >= 0x3FFFE && uc <= 0x3FFFF)
2495  || (uc >= 0x4FFFE && uc <= 0x4FFFF)
2496  || (uc >= 0x5FFFE && uc <= 0x5FFFF)
2497  || (uc >= 0x6FFFE && uc <= 0x6FFFF)
2498  || (uc >= 0x7FFFE && uc <= 0x7FFFF)
2499  || (uc >= 0x8FFFE && uc <= 0x8FFFF)
2500  || (uc >= 0x9FFFE && uc <= 0x9FFFF)
2501  || (uc >= 0xAFFFE && uc <= 0xAFFFF)
2502  || (uc >= 0xBFFFE && uc <= 0xBFFFF)
2503  || (uc >= 0xCFFFE && uc <= 0xCFFFF)
2504  || (uc >= 0xDFFFE && uc <= 0xDFFFF)
2505  || uc == 0xE0001
2506  || (uc >= 0xE0020 && uc <= 0xE007F)
2507  || (uc >= 0xEFFFE && uc <= 0xEFFFF)
2508  || (uc >= 0xF0000 && uc <= 0xFFFFD)
2509  || (uc >= 0xFFFFE && uc <= 0xFFFFF)
2510  || (uc >= 0x100000 && uc <= 0x10FFFD)
2511  || (uc >= 0x10FFFE && uc <= 0x10FFFF))) {
2512  continue;
2513  }
2514  }
2515  return true;
2516  }
2517  return false;
2518 }
bool isLowSurrogate() const
Returns true if the QChar is the low part of a utf16 surrogate (ie.
Definition: qchar.h:279
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QChar * data()
Returns a pointer to the data stored in the QString.
Definition: qstring.h:710
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
unsigned int uint
Definition: qglobal.h:996
unsigned short ushort
Definition: qglobal.h:995
iterator begin()
Returns an STL-style iterator pointing to the first character in the string.
Definition: qstring.h:888
static uint surrogateToUcs4(ushort high, ushort low)
Converts a UTF16 surrogate pair with the given high and low values to its UCS-4 code point...
Definition: qchar.h:297
static const KeyPair *const end

◆ encodeDigit()

static uint encodeDigit ( uint  digit)
inlinestatic

Definition at line 3099 of file qurl.cpp.

Referenced by appendEncode().

3100 {
3101  return digit + 22 + 75 * (digit < 26);
3102 }

◆ equal()

static bool equal ( const QChar a,
int  l,
const char *  b 
)
static

Definition at line 3270 of file qurl.cpp.

Referenced by QDeclarativePropertyPrivate::canConvert(), QScriptValue::equals(), QDateTimeParser::findMonth(), QScriptDebuggerLocalsModel::init(), QAbstractXmlNodeModel::isDeepEqual(), parseHttpOptionHeader(), qt_create_commandline(), qt_is_idn_enabled(), and QProcessEnvironment::systemEnvironment().

3271 {
3272  while (l && a->unicode() && *b) {
3273  if (*a != QLatin1Char(*b))
3274  return false;
3275  ++a;
3276  ++b;
3277  --l;
3278  }
3279  return l == 0;
3280 }
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
long ASN1_INTEGER_get ASN1_INTEGER * a
QFactoryLoader * l
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ fromPercentEncodingHelper()

static QString fromPercentEncodingHelper ( const QByteArray ba)
static

Definition at line 242 of file qurl.cpp.

Referenced by QUrlPrivate::fragmentImpl(), QUrl::fromPercentEncoding(), QUrlPrivate::parse(), QUrl::path(), QUrl::setEncodedHost(), and QUrlPrivate::userInfo().

243 {
244  if (ba.isNull())
245  return QString(); // null
246  QByteArray copy = ba;
247  q_fromPercentEncoding(&copy);
248  return QString::fromUtf8(copy.constData(), copy.length());
249 }
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
Definition: qstring.cpp:4302
void q_fromPercentEncoding(QByteArray *ba)
bool isNull() const
Returns true if this byte array is null; otherwise returns false.
int length() const
Same as size().
Definition: qbytearray.h:356
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433

◆ fromPercentEncodingMutable()

static QString fromPercentEncodingMutable ( QByteArray ba)
static

Definition at line 251 of file qurl.cpp.

Referenced by QUrl::allQueryItemValues(), QUrlPrivate::parse(), QUrl::queryItems(), and QUrl::queryItemValue().

252 {
253  if (ba->isNull())
254  return QString(); // null
256  return QString::fromUtf8(ba->constData(), ba->length());
257 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
Definition: qstring.cpp:4302
void q_fromPercentEncoding(QByteArray *ba)
bool isNull() const
Returns true if this byte array is null; otherwise returns false.
int length() const
Same as size().
Definition: qbytearray.h:356
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433

◆ isBidirectionalL()

static bool isBidirectionalL ( uint  uc)
static

Definition at line 2560 of file qurl.cpp.

Referenced by qt_nameprep().

2561 {
2562  if (uc < 0xaa)
2563  return (uc >= 0x0041 && uc <= 0x005A)
2564  || (uc >= 0x0061 && uc <= 0x007A);
2565 
2566  if (uc == 0x00AA
2567  || uc == 0x00B5
2568  || uc == 0x00BA
2569  || (uc >= 0x00C0 && uc <= 0x00D6)
2570  || (uc >= 0x00D8 && uc <= 0x00F6)
2571  || (uc >= 0x00F8 && uc <= 0x0220)
2572  || (uc >= 0x0222 && uc <= 0x0233)
2573  || (uc >= 0x0250 && uc <= 0x02AD)
2574  || (uc >= 0x02B0 && uc <= 0x02B8)
2575  || (uc >= 0x02BB && uc <= 0x02C1)
2576  || (uc >= 0x02D0 && uc <= 0x02D1)
2577  || (uc >= 0x02E0 && uc <= 0x02E4)
2578  || uc == 0x02EE
2579  || uc == 0x037A
2580  || uc == 0x0386
2581  || (uc >= 0x0388 && uc <= 0x038A)) {
2582  return true;
2583  }
2584 
2585  if (uc == 0x038C
2586  || (uc >= 0x038E && uc <= 0x03A1)
2587  || (uc >= 0x03A3 && uc <= 0x03CE)
2588  || (uc >= 0x03D0 && uc <= 0x03F5)
2589  || (uc >= 0x0400 && uc <= 0x0482)
2590  || (uc >= 0x048A && uc <= 0x04CE)
2591  || (uc >= 0x04D0 && uc <= 0x04F5)
2592  || (uc >= 0x04F8 && uc <= 0x04F9)
2593  || (uc >= 0x0500 && uc <= 0x050F)
2594  || (uc >= 0x0531 && uc <= 0x0556)
2595  || (uc >= 0x0559 && uc <= 0x055F)
2596  || (uc >= 0x0561 && uc <= 0x0587)
2597  || uc == 0x0589
2598  || uc == 0x0903
2599  || (uc >= 0x0905 && uc <= 0x0939)
2600  || (uc >= 0x093D && uc <= 0x0940)
2601  || (uc >= 0x0949 && uc <= 0x094C)
2602  || uc == 0x0950) {
2603  return true;
2604  }
2605 
2606  if ((uc >= 0x0958 && uc <= 0x0961)
2607  || (uc >= 0x0964 && uc <= 0x0970)
2608  || (uc >= 0x0982 && uc <= 0x0983)
2609  || (uc >= 0x0985 && uc <= 0x098C)
2610  || (uc >= 0x098F && uc <= 0x0990)
2611  || (uc >= 0x0993 && uc <= 0x09A8)
2612  || (uc >= 0x09AA && uc <= 0x09B0)
2613  || uc == 0x09B2
2614  || (uc >= 0x09B6 && uc <= 0x09B9)
2615  || (uc >= 0x09BE && uc <= 0x09C0)
2616  || (uc >= 0x09C7 && uc <= 0x09C8)
2617  || (uc >= 0x09CB && uc <= 0x09CC)
2618  || uc == 0x09D7
2619  || (uc >= 0x09DC && uc <= 0x09DD)
2620  || (uc >= 0x09DF && uc <= 0x09E1)
2621  || (uc >= 0x09E6 && uc <= 0x09F1)
2622  || (uc >= 0x09F4 && uc <= 0x09FA)
2623  || (uc >= 0x0A05 && uc <= 0x0A0A)
2624  || (uc >= 0x0A0F && uc <= 0x0A10)
2625  || (uc >= 0x0A13 && uc <= 0x0A28)
2626  || (uc >= 0x0A2A && uc <= 0x0A30)
2627  || (uc >= 0x0A32 && uc <= 0x0A33)) {
2628  return true;
2629  }
2630 
2631  if ((uc >= 0x0A35 && uc <= 0x0A36)
2632  || (uc >= 0x0A38 && uc <= 0x0A39)
2633  || (uc >= 0x0A3E && uc <= 0x0A40)
2634  || (uc >= 0x0A59 && uc <= 0x0A5C)
2635  || uc == 0x0A5E
2636  || (uc >= 0x0A66 && uc <= 0x0A6F)
2637  || (uc >= 0x0A72 && uc <= 0x0A74)
2638  || uc == 0x0A83
2639  || (uc >= 0x0A85 && uc <= 0x0A8B)
2640  || uc == 0x0A8D
2641  || (uc >= 0x0A8F && uc <= 0x0A91)
2642  || (uc >= 0x0A93 && uc <= 0x0AA8)
2643  || (uc >= 0x0AAA && uc <= 0x0AB0)
2644  || (uc >= 0x0AB2 && uc <= 0x0AB3)
2645  || (uc >= 0x0AB5 && uc <= 0x0AB9)
2646  || (uc >= 0x0ABD && uc <= 0x0AC0)
2647  || uc == 0x0AC9
2648  || (uc >= 0x0ACB && uc <= 0x0ACC)
2649  || uc == 0x0AD0
2650  || uc == 0x0AE0
2651  || (uc >= 0x0AE6 && uc <= 0x0AEF)
2652  || (uc >= 0x0B02 && uc <= 0x0B03)
2653  || (uc >= 0x0B05 && uc <= 0x0B0C)
2654  || (uc >= 0x0B0F && uc <= 0x0B10)
2655  || (uc >= 0x0B13 && uc <= 0x0B28)
2656  || (uc >= 0x0B2A && uc <= 0x0B30)) {
2657  return true;
2658  }
2659 
2660  if ((uc >= 0x0B32 && uc <= 0x0B33)
2661  || (uc >= 0x0B36 && uc <= 0x0B39)
2662  || (uc >= 0x0B3D && uc <= 0x0B3E)
2663  || uc == 0x0B40
2664  || (uc >= 0x0B47 && uc <= 0x0B48)
2665  || (uc >= 0x0B4B && uc <= 0x0B4C)
2666  || uc == 0x0B57
2667  || (uc >= 0x0B5C && uc <= 0x0B5D)
2668  || (uc >= 0x0B5F && uc <= 0x0B61)
2669  || (uc >= 0x0B66 && uc <= 0x0B70)
2670  || uc == 0x0B83
2671  || (uc >= 0x0B85 && uc <= 0x0B8A)
2672  || (uc >= 0x0B8E && uc <= 0x0B90)
2673  || (uc >= 0x0B92 && uc <= 0x0B95)
2674  || (uc >= 0x0B99 && uc <= 0x0B9A)
2675  || uc == 0x0B9C
2676  || (uc >= 0x0B9E && uc <= 0x0B9F)
2677  || (uc >= 0x0BA3 && uc <= 0x0BA4)
2678  || (uc >= 0x0BA8 && uc <= 0x0BAA)
2679  || (uc >= 0x0BAE && uc <= 0x0BB5)
2680  || (uc >= 0x0BB7 && uc <= 0x0BB9)
2681  || (uc >= 0x0BBE && uc <= 0x0BBF)
2682  || (uc >= 0x0BC1 && uc <= 0x0BC2)
2683  || (uc >= 0x0BC6 && uc <= 0x0BC8)
2684  || (uc >= 0x0BCA && uc <= 0x0BCC)
2685  || uc == 0x0BD7
2686  || (uc >= 0x0BE7 && uc <= 0x0BF2)
2687  || (uc >= 0x0C01 && uc <= 0x0C03)
2688  || (uc >= 0x0C05 && uc <= 0x0C0C)
2689  || (uc >= 0x0C0E && uc <= 0x0C10)
2690  || (uc >= 0x0C12 && uc <= 0x0C28)
2691  || (uc >= 0x0C2A && uc <= 0x0C33)
2692  || (uc >= 0x0C35 && uc <= 0x0C39)) {
2693  return true;
2694  }
2695  if ((uc >= 0x0C41 && uc <= 0x0C44)
2696  || (uc >= 0x0C60 && uc <= 0x0C61)
2697  || (uc >= 0x0C66 && uc <= 0x0C6F)
2698  || (uc >= 0x0C82 && uc <= 0x0C83)
2699  || (uc >= 0x0C85 && uc <= 0x0C8C)
2700  || (uc >= 0x0C8E && uc <= 0x0C90)
2701  || (uc >= 0x0C92 && uc <= 0x0CA8)
2702  || (uc >= 0x0CAA && uc <= 0x0CB3)
2703  || (uc >= 0x0CB5 && uc <= 0x0CB9)
2704  || uc == 0x0CBE
2705  || (uc >= 0x0CC0 && uc <= 0x0CC4)
2706  || (uc >= 0x0CC7 && uc <= 0x0CC8)
2707  || (uc >= 0x0CCA && uc <= 0x0CCB)
2708  || (uc >= 0x0CD5 && uc <= 0x0CD6)
2709  || uc == 0x0CDE
2710  || (uc >= 0x0CE0 && uc <= 0x0CE1)
2711  || (uc >= 0x0CE6 && uc <= 0x0CEF)
2712  || (uc >= 0x0D02 && uc <= 0x0D03)
2713  || (uc >= 0x0D05 && uc <= 0x0D0C)
2714  || (uc >= 0x0D0E && uc <= 0x0D10)
2715  || (uc >= 0x0D12 && uc <= 0x0D28)
2716  || (uc >= 0x0D2A && uc <= 0x0D39)
2717  || (uc >= 0x0D3E && uc <= 0x0D40)
2718  || (uc >= 0x0D46 && uc <= 0x0D48)
2719  || (uc >= 0x0D4A && uc <= 0x0D4C)
2720  || uc == 0x0D57
2721  || (uc >= 0x0D60 && uc <= 0x0D61)
2722  || (uc >= 0x0D66 && uc <= 0x0D6F)
2723  || (uc >= 0x0D82 && uc <= 0x0D83)
2724  || (uc >= 0x0D85 && uc <= 0x0D96)
2725  || (uc >= 0x0D9A && uc <= 0x0DB1)
2726  || (uc >= 0x0DB3 && uc <= 0x0DBB)
2727  || uc == 0x0DBD) {
2728  return true;
2729  }
2730  if ((uc >= 0x0DC0 && uc <= 0x0DC6)
2731  || (uc >= 0x0DCF && uc <= 0x0DD1)
2732  || (uc >= 0x0DD8 && uc <= 0x0DDF)
2733  || (uc >= 0x0DF2 && uc <= 0x0DF4)
2734  || (uc >= 0x0E01 && uc <= 0x0E30)
2735  || (uc >= 0x0E32 && uc <= 0x0E33)
2736  || (uc >= 0x0E40 && uc <= 0x0E46)
2737  || (uc >= 0x0E4F && uc <= 0x0E5B)
2738  || (uc >= 0x0E81 && uc <= 0x0E82)
2739  || uc == 0x0E84
2740  || (uc >= 0x0E87 && uc <= 0x0E88)
2741  || uc == 0x0E8A
2742  || uc == 0x0E8D
2743  || (uc >= 0x0E94 && uc <= 0x0E97)
2744  || (uc >= 0x0E99 && uc <= 0x0E9F)
2745  || (uc >= 0x0EA1 && uc <= 0x0EA3)
2746  || uc == 0x0EA5
2747  || uc == 0x0EA7
2748  || (uc >= 0x0EAA && uc <= 0x0EAB)
2749  || (uc >= 0x0EAD && uc <= 0x0EB0)
2750  || (uc >= 0x0EB2 && uc <= 0x0EB3)
2751  || uc == 0x0EBD
2752  || (uc >= 0x0EC0 && uc <= 0x0EC4)
2753  || uc == 0x0EC6
2754  || (uc >= 0x0ED0 && uc <= 0x0ED9)
2755  || (uc >= 0x0EDC && uc <= 0x0EDD)
2756  || (uc >= 0x0F00 && uc <= 0x0F17)
2757  || (uc >= 0x0F1A && uc <= 0x0F34)
2758  || uc == 0x0F36
2759  || uc == 0x0F38
2760  || (uc >= 0x0F3E && uc <= 0x0F47)
2761  || (uc >= 0x0F49 && uc <= 0x0F6A)
2762  || uc == 0x0F7F
2763  || uc == 0x0F85
2764  || (uc >= 0x0F88 && uc <= 0x0F8B)
2765  || (uc >= 0x0FBE && uc <= 0x0FC5)
2766  || (uc >= 0x0FC7 && uc <= 0x0FCC)
2767  || uc == 0x0FCF) {
2768  return true;
2769  }
2770 
2771  if ((uc >= 0x1000 && uc <= 0x1021)
2772  || (uc >= 0x1023 && uc <= 0x1027)
2773  || (uc >= 0x1029 && uc <= 0x102A)
2774  || uc == 0x102C
2775  || uc == 0x1031
2776  || uc == 0x1038
2777  || (uc >= 0x1040 && uc <= 0x1057)
2778  || (uc >= 0x10A0 && uc <= 0x10C5)
2779  || (uc >= 0x10D0 && uc <= 0x10F8)
2780  || uc == 0x10FB
2781  || (uc >= 0x1100 && uc <= 0x1159)
2782  || (uc >= 0x115F && uc <= 0x11A2)
2783  || (uc >= 0x11A8 && uc <= 0x11F9)
2784  || (uc >= 0x1200 && uc <= 0x1206)
2785  || (uc >= 0x1208 && uc <= 0x1246)
2786  || uc == 0x1248
2787  || (uc >= 0x124A && uc <= 0x124D)
2788  || (uc >= 0x1250 && uc <= 0x1256)
2789  || uc == 0x1258
2790  || (uc >= 0x125A && uc <= 0x125D)
2791  || (uc >= 0x1260 && uc <= 0x1286)
2792  || uc == 0x1288
2793  || (uc >= 0x128A && uc <= 0x128D)
2794  || (uc >= 0x1290 && uc <= 0x12AE)
2795  || uc == 0x12B0
2796  || (uc >= 0x12B2 && uc <= 0x12B5)
2797  || (uc >= 0x12B8 && uc <= 0x12BE)
2798  || uc == 0x12C0
2799  || (uc >= 0x12C2 && uc <= 0x12C5)
2800  || (uc >= 0x12C8 && uc <= 0x12CE)
2801  || (uc >= 0x12D0 && uc <= 0x12D6)
2802  || (uc >= 0x12D8 && uc <= 0x12EE)
2803  || (uc >= 0x12F0 && uc <= 0x130E)
2804  || uc == 0x1310) {
2805  return true;
2806  }
2807 
2808  if ((uc >= 0x1312 && uc <= 0x1315)
2809  || (uc >= 0x1318 && uc <= 0x131E)
2810  || (uc >= 0x1320 && uc <= 0x1346)
2811  || (uc >= 0x1348 && uc <= 0x135A)
2812  || (uc >= 0x1361 && uc <= 0x137C)
2813  || (uc >= 0x13A0 && uc <= 0x13F4)
2814  || (uc >= 0x1401 && uc <= 0x1676)
2815  || (uc >= 0x1681 && uc <= 0x169A)
2816  || (uc >= 0x16A0 && uc <= 0x16F0)
2817  || (uc >= 0x1700 && uc <= 0x170C)
2818  || (uc >= 0x170E && uc <= 0x1711)
2819  || (uc >= 0x1720 && uc <= 0x1731)
2820  || (uc >= 0x1735 && uc <= 0x1736)
2821  || (uc >= 0x1740 && uc <= 0x1751)
2822  || (uc >= 0x1760 && uc <= 0x176C)
2823  || (uc >= 0x176E && uc <= 0x1770)
2824  || (uc >= 0x1780 && uc <= 0x17B6)
2825  || (uc >= 0x17BE && uc <= 0x17C5)
2826  || (uc >= 0x17C7 && uc <= 0x17C8)
2827  || (uc >= 0x17D4 && uc <= 0x17DA)
2828  || uc == 0x17DC
2829  || (uc >= 0x17E0 && uc <= 0x17E9)
2830  || (uc >= 0x1810 && uc <= 0x1819)
2831  || (uc >= 0x1820 && uc <= 0x1877)
2832  || (uc >= 0x1880 && uc <= 0x18A8)
2833  || (uc >= 0x1E00 && uc <= 0x1E9B)
2834  || (uc >= 0x1EA0 && uc <= 0x1EF9)
2835  || (uc >= 0x1F00 && uc <= 0x1F15)
2836  || (uc >= 0x1F18 && uc <= 0x1F1D)
2837  || (uc >= 0x1F20 && uc <= 0x1F45)
2838  || (uc >= 0x1F48 && uc <= 0x1F4D)
2839  || (uc >= 0x1F50 && uc <= 0x1F57)
2840  || uc == 0x1F59
2841  || uc == 0x1F5B
2842  || uc == 0x1F5D) {
2843  return true;
2844  }
2845 
2846  if ((uc >= 0x1F5F && uc <= 0x1F7D)
2847  || (uc >= 0x1F80 && uc <= 0x1FB4)
2848  || (uc >= 0x1FB6 && uc <= 0x1FBC)
2849  || uc == 0x1FBE
2850  || (uc >= 0x1FC2 && uc <= 0x1FC4)
2851  || (uc >= 0x1FC6 && uc <= 0x1FCC)
2852  || (uc >= 0x1FD0 && uc <= 0x1FD3)
2853  || (uc >= 0x1FD6 && uc <= 0x1FDB)
2854  || (uc >= 0x1FE0 && uc <= 0x1FEC)
2855  || (uc >= 0x1FF2 && uc <= 0x1FF4)
2856  || (uc >= 0x1FF6 && uc <= 0x1FFC)
2857  || uc == 0x200E
2858  || uc == 0x2071
2859  || uc == 0x207F
2860  || uc == 0x2102
2861  || uc == 0x2107
2862  || (uc >= 0x210A && uc <= 0x2113)
2863  || uc == 0x2115
2864  || (uc >= 0x2119 && uc <= 0x211D)) {
2865  return true;
2866  }
2867 
2868  if (uc == 0x2124
2869  || uc == 0x2126
2870  || uc == 0x2128
2871  || (uc >= 0x212A && uc <= 0x212D)
2872  || (uc >= 0x212F && uc <= 0x2131)
2873  || (uc >= 0x2133 && uc <= 0x2139)
2874  || (uc >= 0x213D && uc <= 0x213F)
2875  || (uc >= 0x2145 && uc <= 0x2149)
2876  || (uc >= 0x2160 && uc <= 0x2183)
2877  || (uc >= 0x2336 && uc <= 0x237A)
2878  || uc == 0x2395
2879  || (uc >= 0x249C && uc <= 0x24E9)
2880  || (uc >= 0x3005 && uc <= 0x3007)
2881  || (uc >= 0x3021 && uc <= 0x3029)
2882  || (uc >= 0x3031 && uc <= 0x3035)
2883  || (uc >= 0x3038 && uc <= 0x303C)
2884  || (uc >= 0x3041 && uc <= 0x3096)
2885  || (uc >= 0x309D && uc <= 0x309F)
2886  || (uc >= 0x30A1 && uc <= 0x30FA)) {
2887  return true;
2888  }
2889 
2890  if ((uc >= 0x30FC && uc <= 0x30FF)
2891  || (uc >= 0x3105 && uc <= 0x312C)
2892  || (uc >= 0x3131 && uc <= 0x318E)
2893  || (uc >= 0x3190 && uc <= 0x31B7)
2894  || (uc >= 0x31F0 && uc <= 0x321C)
2895  || (uc >= 0x3220 && uc <= 0x3243)) {
2896  return true;
2897  }
2898 
2899  if ((uc >= 0x3260 && uc <= 0x327B)
2900  || (uc >= 0x327F && uc <= 0x32B0)
2901  || (uc >= 0x32C0 && uc <= 0x32CB)
2902  || (uc >= 0x32D0 && uc <= 0x32FE)
2903  || (uc >= 0x3300 && uc <= 0x3376)
2904  || (uc >= 0x337B && uc <= 0x33DD)) {
2905  return true;
2906  }
2907  if ((uc >= 0x33E0 && uc <= 0x33FE)
2908  || (uc >= 0x3400 && uc <= 0x4DB5)
2909  || (uc >= 0x4E00 && uc <= 0x9FA5)
2910  || (uc >= 0xA000 && uc <= 0xA48C)
2911  || (uc >= 0xAC00 && uc <= 0xD7A3)
2912  || (uc >= 0xD800 && uc <= 0xFA2D)
2913  || (uc >= 0xFA30 && uc <= 0xFA6A)
2914  || (uc >= 0xFB00 && uc <= 0xFB06)
2915  || (uc >= 0xFB13 && uc <= 0xFB17)
2916  || (uc >= 0xFF21 && uc <= 0xFF3A)
2917  || (uc >= 0xFF41 && uc <= 0xFF5A)
2918  || (uc >= 0xFF66 && uc <= 0xFFBE)
2919  || (uc >= 0xFFC2 && uc <= 0xFFC7)
2920  || (uc >= 0xFFCA && uc <= 0xFFCF)
2921  || (uc >= 0xFFD2 && uc <= 0xFFD7)
2922  || (uc >= 0xFFDA && uc <= 0xFFDC)) {
2923  return true;
2924  }
2925 
2926  if ((uc >= 0x10300 && uc <= 0x1031E)
2927  || (uc >= 0x10320 && uc <= 0x10323)
2928  || (uc >= 0x10330 && uc <= 0x1034A)
2929  || (uc >= 0x10400 && uc <= 0x10425)
2930  || (uc >= 0x10428 && uc <= 0x1044D)
2931  || (uc >= 0x1D000 && uc <= 0x1D0F5)
2932  || (uc >= 0x1D100 && uc <= 0x1D126)
2933  || (uc >= 0x1D12A && uc <= 0x1D166)
2934  || (uc >= 0x1D16A && uc <= 0x1D172)
2935  || (uc >= 0x1D183 && uc <= 0x1D184)
2936  || (uc >= 0x1D18C && uc <= 0x1D1A9)
2937  || (uc >= 0x1D1AE && uc <= 0x1D1DD)
2938  || (uc >= 0x1D400 && uc <= 0x1D454)
2939  || (uc >= 0x1D456 && uc <= 0x1D49C)
2940  || (uc >= 0x1D49E && uc <= 0x1D49F)
2941  || uc == 0x1D4A2
2942  || (uc >= 0x1D4A5 && uc <= 0x1D4A6)
2943  || (uc >= 0x1D4A9 && uc <= 0x1D4AC)
2944  || (uc >= 0x1D4AE && uc <= 0x1D4B9)
2945  || uc == 0x1D4BB
2946  || (uc >= 0x1D4BD && uc <= 0x1D4C0)
2947  || (uc >= 0x1D4C2 && uc <= 0x1D4C3)
2948  || (uc >= 0x1D4C5 && uc <= 0x1D505)
2949  || (uc >= 0x1D507 && uc <= 0x1D50A)
2950  || (uc >= 0x1D50D && uc <= 0x1D514)
2951  || (uc >= 0x1D516 && uc <= 0x1D51C)
2952  || (uc >= 0x1D51E && uc <= 0x1D539)
2953  || (uc >= 0x1D53B && uc <= 0x1D53E)
2954  || (uc >= 0x1D540 && uc <= 0x1D544)
2955  || uc == 0x1D546
2956  || (uc >= 0x1D54A && uc <= 0x1D550)
2957  || (uc >= 0x1D552 && uc <= 0x1D6A3)
2958  || (uc >= 0x1D6A8 && uc <= 0x1D7C9)
2959  || (uc >= 0x20000 && uc <= 0x2A6D6)
2960  || (uc >= 0x2F800 && uc <= 0x2FA1D)
2961  || (uc >= 0xF0000 && uc <= 0xFFFFD)
2962  || (uc >= 0x100000 && uc <= 0x10FFFD)) {
2963  return true;
2964  }
2965 
2966  return false;
2967 }

◆ isBidirectionalRorAL()

static bool isBidirectionalRorAL ( uint  uc)
static

Definition at line 2520 of file qurl.cpp.

Referenced by qt_nameprep().

2521 {
2522  if (uc < 0x5b0)
2523  return false;
2524  return uc == 0x05BE
2525  || uc == 0x05C0
2526  || uc == 0x05C3
2527  || (uc >= 0x05D0 && uc <= 0x05EA)
2528  || (uc >= 0x05F0 && uc <= 0x05F4)
2529  || uc == 0x061B
2530  || uc == 0x061F
2531  || (uc >= 0x0621 && uc <= 0x063A)
2532  || (uc >= 0x0640 && uc <= 0x064A)
2533  || (uc >= 0x066D && uc <= 0x066F)
2534  || (uc >= 0x0671 && uc <= 0x06D5)
2535  || uc == 0x06DD
2536  || (uc >= 0x06E5 && uc <= 0x06E6)
2537  || (uc >= 0x06FA && uc <= 0x06FE)
2538  || (uc >= 0x0700 && uc <= 0x070D)
2539  || uc == 0x0710
2540  || (uc >= 0x0712 && uc <= 0x072C)
2541  || (uc >= 0x0780 && uc <= 0x07A5)
2542  || uc == 0x07B1
2543  || uc == 0x200F
2544  || uc == 0xFB1D
2545  || (uc >= 0xFB1F && uc <= 0xFB28)
2546  || (uc >= 0xFB2A && uc <= 0xFB36)
2547  || (uc >= 0xFB38 && uc <= 0xFB3C)
2548  || uc == 0xFB3E
2549  || (uc >= 0xFB40 && uc <= 0xFB41)
2550  || (uc >= 0xFB43 && uc <= 0xFB44)
2551  || (uc >= 0xFB46 && uc <= 0xFBB1)
2552  || (uc >= 0xFBD3 && uc <= 0xFD3D)
2553  || (uc >= 0xFD50 && uc <= 0xFD8F)
2554  || (uc >= 0xFD92 && uc <= 0xFDC7)
2555  || (uc >= 0xFDF0 && uc <= 0xFDFC)
2556  || (uc >= 0xFE70 && uc <= 0xFE74)
2557  || (uc >= 0xFE76 && uc <= 0xFEFC);
2558 }

◆ isDotDelimiter()

static bool isDotDelimiter ( ushort  uc)
inlinestatic

Definition at line 3311 of file qurl.cpp.

Referenced by nextDotDelimiter().

3312 {
3313  // IDNA / rfc3490 describes these four delimiters used for
3314  // separating labels in unicode international domain
3315  // names.
3316  return uc == 0x2e || uc == 0x3002 || uc == 0xff0e || uc == 0xff61;
3317 }

◆ isHex()

static bool isHex ( char  c)
inlinestatic

Definition at line 4434 of file qurl.cpp.

Referenced by QUrlPrivate::setEncodedUrl().

4435 {
4436  c |= 0x20;
4437  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f');
4438 }
unsigned char c[8]
Definition: qnumeric_p.h:62

◆ isMappedToNothing()

static bool isMappedToNothing ( uint  uc)
static

Definition at line 2433 of file qurl.cpp.

Referenced by qt_nameprep().

2434 {
2435  if (uc < 0xad)
2436  return false;
2437  switch (uc) {
2438  case 0x00AD: case 0x034F: case 0x1806: case 0x180B: case 0x180C: case 0x180D:
2439  case 0x200B: case 0x200C: case 0x200D: case 0x2060: case 0xFE00: case 0xFE01:
2440  case 0xFE02: case 0xFE03: case 0xFE04: case 0xFE05: case 0xFE06: case 0xFE07:
2441  case 0xFE08: case 0xFE09: case 0xFE0A: case 0xFE0B: case 0xFE0C: case 0xFE0D:
2442  case 0xFE0E: case 0xFE0F: case 0xFEFF:
2443  return true;
2444  default:
2445  return false;
2446  }
2447 }

◆ lessThan()

static bool lessThan ( const QChar a,
int  l,
const char *  c 
)
static

Definition at line 3253 of file qurl.cpp.

Referenced by QPatternist::DerivedInteger< DerivedType >::fromValue(), QDeclarativeStyledTextPrivate::parse(), QAlgorithmsPrivate::qBinaryFindHelper(), QAlgorithmsPrivate::qLowerBoundHelper(), QAlgorithmsPrivate::qMerge(), QAlgorithmsPrivate::qSortHelper(), qt_is_idn_enabled(), QAlgorithmsPrivate::qUpperBoundHelper(), and sort().

3254 {
3255  const ushort *uc = (const ushort *)a;
3256  const ushort *e = uc + l;
3257 
3258  if (!c || *c == 0)
3259  return false;
3260 
3261  while (*c) {
3262  if (uc == e || *uc != *c)
3263  break;
3264  ++uc;
3265  ++c;
3266  }
3267  return (uc == e ? *c : *uc < *c);
3268 }
unsigned char c[8]
Definition: qnumeric_p.h:62
unsigned short ushort
Definition: qglobal.h:995
QFactoryLoader * l

◆ mapToLowerCase()

static void mapToLowerCase ( QString str,
int  from 
)
static

Definition at line 2388 of file qurl.cpp.

Referenced by qt_nameprep().

2389 {
2390  int N = sizeof(NameprepCaseFolding) / sizeof(NameprepCaseFolding[0]);
2391 
2392  ushort *d = 0;
2393  for (int i = from; i < str->size(); ++i) {
2394  uint uc = str->at(i).unicode();
2395  if (uc < 0x80) {
2396  if (uc <= 'Z' && uc >= 'A') {
2397  if (!d)
2398  d = reinterpret_cast<ushort *>(str->data());
2399  d[i] = (uc | 0x20);
2400  }
2401  } else {
2402  if (QChar(uc).isHighSurrogate() && i < str->size() - 1) {
2403  ushort low = str->at(i + 1).unicode();
2404  if (QChar(low).isLowSurrogate()) {
2405  uc = QChar::surrogateToUcs4(uc, low);
2406  ++i;
2407  }
2408  }
2410  NameprepCaseFolding + N,
2411  uc);
2412  if ((entry - NameprepCaseFolding) != N) {
2413  int l = 1;
2414  while (l < 4 && entry->mapping[l])
2415  ++l;
2416  if (l > 1 || uc > 0xffff) {
2417  if (uc <= 0xffff)
2418  str->replace(i, 1, reinterpret_cast<const QChar *>(&entry->mapping[0]), l);
2419  else
2420  str->replace(--i, 2, reinterpret_cast<const QChar *>(&entry->mapping[0]), l);
2421  i += l - 1;
2422  d = 0;
2423  } else {
2424  if (!d)
2425  d = reinterpret_cast<ushort *>(str->data());
2426  d[i] = entry->mapping[0];
2427  }
2428  }
2429  }
2430  }
2431 }
double d
Definition: qnumeric_p.h:62
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
static const NameprepCaseFoldingEntry NameprepCaseFolding[]
Definition: qurl.cpp:1014
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
QString & replace(int i, int len, QChar after)
Definition: qstring.cpp:2005
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
Definition: qalgorithms.h:295
bool isHighSurrogate() const
Returns true if the QChar is the high part of a utf16 surrogate (ie.
Definition: qchar.h:276
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QChar * data()
Returns a pointer to the data stored in the QString.
Definition: qstring.h:710
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
unsigned int uint
Definition: qglobal.h:996
unsigned short ushort
Definition: qglobal.h:995
static QMap< QByteArray, int > mapping
Definition: qaxserver.cpp:577
QFactoryLoader * l
static uint surrogateToUcs4(ushort high, ushort low)
Converts a UTF16 surrogate pair with the given high and low values to its UCS-4 code point...
Definition: qchar.h:297

◆ nextDotDelimiter()

static int nextDotDelimiter ( const QString domain,
int  from = 0 
)
static

Definition at line 3319 of file qurl.cpp.

Referenced by qt_ACE_do().

3320 {
3321  const QChar *b = domain.unicode();
3322  const QChar *ch = b + from;
3323  const QChar *e = b + domain.length();
3324  while (ch < e) {
3325  if (isDotDelimiter(ch->unicode()))
3326  break;
3327  else
3328  ++ch;
3329  }
3330  return ch - b;
3331 }
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
static bool isDotDelimiter(ushort uc)
Definition: qurl.cpp:3311
const QChar * unicode() const
Returns a &#39;\0&#39;-terminated Unicode representation of the string.
Definition: qstring.h:706

◆ operator<() [1/2]

bool operator< ( uint  one,
const NameprepCaseFoldingEntry other 
)
inline

Definition at line 1008 of file qurl.cpp.

1009 { return one < other.uc; }

◆ operator<() [2/2]

bool operator< ( const NameprepCaseFoldingEntry one,
uint  other 
)
inline

Definition at line 1011 of file qurl.cpp.

1012 { return one.uc < other; }

◆ operator<<()

QDebug operator<< ( QDebug  d,
const QUrl url 
)

Definition at line 6784 of file qurl.cpp.

6785 {
6786  d.maybeSpace() << "QUrl(" << url.toString() << ')';
6787  return d.space();
6788 }
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
Definition: qurl.cpp:5896
QDebug & maybeSpace()
Writes a space character to the debug stream, depending on the last character sent to the stream...
Definition: qdebug.h:93
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91

◆ q_fromPercentEncoding()

void q_fromPercentEncoding ( QByteArray ba)

Definition at line 4331 of file qbytearray.cpp.

Referenced by fromPercentEncodingHelper(), and fromPercentEncodingMutable().

4332 {
4333  q_fromPercentEncoding(ba, '%');
4334 }
static void q_fromPercentEncoding(QByteArray *ba, char percent)

◆ q_normalizePercentEncoding()

void q_normalizePercentEncoding ( QByteArray ba,
const char *  exclude 
)

Definition at line 4429 of file qbytearray.cpp.

Referenced by QUrlPrivate::normalized().

4430 {
4431  q_fromPercentEncoding(ba, '%');
4432  q_toPercentEncoding(ba, exclude, 0, '%');
4433 }
static void q_fromPercentEncoding(QByteArray *ba, char percent)
static void q_toPercentEncoding(QByteArray *ba, const char *dontEncode, const char *alsoEncode, char percent)

◆ q_toPercentEncoding()

void q_toPercentEncoding ( QByteArray ba,
const char *  exclude,
const char *  include = 0 
)

Definition at line 4424 of file qbytearray.cpp.

Referenced by toPercentEncodingHelper().

4425 {
4426  q_toPercentEncoding(ba, exclude, include, '%');
4427 }
static void q_toPercentEncoding(QByteArray *ba, const char *dontEncode, const char *alsoEncode, char percent)

◆ qsnprintf()

Q_CORE_EXPORT int qsnprintf ( char *  str,
size_t  n,
const char *  fmt,
  ... 
)
related

◆ qt_ACE_do()

static QString qt_ACE_do ( const QString domain,
AceOperation  op 
)
static

Definition at line 3334 of file qurl.cpp.

Referenced by QUrlPrivate::canonicalHost(), QUrl::fromAce(), and QUrl::toAce().

3335 {
3336  if (domain.isEmpty())
3337  return domain;
3338 
3339  QString result;
3340  result.reserve(domain.length());
3341 
3342  const bool isIdnEnabled = op == NormalizeAce ? qt_is_idn_enabled(domain) : false;
3343  int lastIdx = 0;
3344  QString aceForm; // this variable is here for caching
3345 
3346  while (1) {
3347  int idx = nextDotDelimiter(domain, lastIdx);
3348  int labelLength = idx - lastIdx;
3349  if (labelLength == 0) {
3350  if (idx == domain.length())
3351  break;
3352  return QString(); // two delimiters in a row -- empty label not allowed
3353  }
3354 
3355  // RFC 3490 says, about the ToASCII operation:
3356  // 3. If the UseSTD3ASCIIRules flag is set, then perform these checks:
3357  //
3358  // (a) Verify the absence of non-LDH ASCII code points; that is, the
3359  // absence of 0..2C, 2E..2F, 3A..40, 5B..60, and 7B..7F.
3360  //
3361  // (b) Verify the absence of leading and trailing hyphen-minus; that
3362  // is, the absence of U+002D at the beginning and end of the
3363  // sequence.
3364  // and:
3365  // 8. Verify that the number of code points is in the range 1 to 63
3366  // inclusive.
3367 
3368  // copy the label to the destination, which also serves as our scratch area, lowercasing it
3369  int prevLen = result.size();
3370  bool simple = true;
3371  result.resize(prevLen + labelLength);
3372  {
3373  QChar *out = result.data() + prevLen;
3374  const QChar *in = domain.constData() + lastIdx;
3375  const QChar *e = in + labelLength;
3376  for (; in < e; ++in, ++out) {
3377  register ushort uc = in->unicode();
3378  if (uc > 0x7f)
3379  simple = false;
3380  if (uc >= 'A' && uc <= 'Z')
3381  *out = QChar(uc | 0x20);
3382  else
3383  *out = *in;
3384  }
3385  }
3386 
3387  if (simple && labelLength > 6) {
3388  // ACE form domains contain only ASCII characters, but we can't consider them simple
3389  // is this an ACE form?
3390  // the shortest valid ACE domain is 6 characters long (U+0080 would be 1, but it's not allowed)
3391  static const ushort acePrefixUtf16[] = { 'x', 'n', '-', '-' };
3392  if (memcmp(result.constData() + prevLen, acePrefixUtf16, sizeof acePrefixUtf16) == 0)
3393  simple = false;
3394  }
3395 
3396  if (simple) {
3397  // fastest case: this is the common case (non IDN-domains)
3398  // so we're done
3399  if (!qt_check_std3rules(result.constData() + prevLen, labelLength))
3400  return QString();
3401  } else {
3402  // Punycode encoding and decoding cannot be done in-place
3403  // That means we need one or two temporaries
3404  qt_nameprep(&result, prevLen);
3405  labelLength = result.length() - prevLen;
3406  register int toReserve = labelLength + 4 + 6; // "xn--" plus some extra bytes
3407  aceForm.resize(0);
3408  if (toReserve > aceForm.capacity())
3409  aceForm.reserve(toReserve);
3410  toPunycodeHelper(result.constData() + prevLen, result.size() - prevLen, &aceForm);
3411 
3412  // We use resize()+memcpy() here because we're overwriting the data we've copied
3413  if (isIdnEnabled) {
3414  QString tmp = QUrl::fromPunycode(aceForm.toLatin1());
3415  if (tmp.isEmpty())
3416  return QString(); // shouldn't happen, since we've just punycode-encoded it
3417  result.resize(prevLen + tmp.size());
3418  memcpy(result.data() + prevLen, tmp.constData(), tmp.size() * sizeof(QChar));
3419  } else {
3420  result.resize(prevLen + aceForm.size());
3421  memcpy(result.data() + prevLen, aceForm.constData(), aceForm.size() * sizeof(QChar));
3422  }
3423 
3424  if (!qt_check_std3rules(aceForm.constData(), aceForm.size()))
3425  return QString();
3426  }
3427 
3428 
3429  lastIdx = idx + 1;
3430  if (lastIdx < domain.size() + 1)
3431  result += QLatin1Char('.');
3432  else
3433  break;
3434  }
3435  return result;
3436 }
static void toPunycodeHelper(const QChar *s, int ucLength, QString *output)
Definition: qurl.cpp:3140
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
The QString class provides a Unicode character string.
Definition: qstring.h:83
static bool qt_check_std3rules(const QChar *uc, int len)
Definition: qurl.cpp:3073
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QChar * data()
Returns a pointer to the data stored in the QString.
Definition: qstring.h:710
void reserve(int size)
Attempts to allocate memory for at least size characters.
Definition: qstring.h:881
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
static QString fromPunycode(const QByteArray &)
Returns the Punycode decoded representation of pc.
Definition: qurl.cpp:6044
static void qt_nameprep(QString *source, int from)
Definition: qurl.cpp:2979
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
void resize(int size)
Sets the size of the string to size characters.
Definition: qstring.cpp:1353
int capacity() const
Returns the maximum number of characters that can be stored in the string without forcing a reallocat...
Definition: qstring.h:727
unsigned short ushort
Definition: qglobal.h:995
static bool qt_is_idn_enabled(const QString &domain)
Definition: qurl.cpp:3282
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
const QChar * constData() const
Returns a pointer to the data stored in the QString.
Definition: qstring.h:712
static int nextDotDelimiter(const QString &domain, int from=0)
Definition: qurl.cpp:3319

◆ qt_check_std3rules()

bool qt_check_std3rules ( const QChar uc,
int  len 
)
static

Definition at line 3073 of file qurl.cpp.

Referenced by isBidirectionalL(), and qt_ACE_do().

3074 {
3075  if (len > 63)
3076  return false;
3077 
3078  for (int i = 0; i < len; ++i) {
3079  register ushort c = uc[i].unicode();
3080  if (c == '-' && (i == 0 || i == len - 1))
3081  return false;
3082 
3083  // verifying the absence of LDH is the same as verifying that
3084  // only LDH is present
3085  if (c == '-' || (c >= '0' && c <= '9')
3086  || (c >= 'A' && c <= 'Z')
3087  || (c >= 'a' && c <= 'z')
3088  //underscore is not supposed to be allowed, but other browser accept it (QTBUG-7434)
3089  || c == '_')
3090  continue;
3091 
3092  return false;
3093  }
3094 
3095  return true;
3096 }
unsigned char c[8]
Definition: qnumeric_p.h:62
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
unsigned short ushort
Definition: qglobal.h:995

◆ qt_is_idn_enabled()

static bool qt_is_idn_enabled ( const QString domain)
static

Definition at line 3282 of file qurl.cpp.

Referenced by qt_ACE_do().

3283 {
3284  int idx = domain.lastIndexOf(QLatin1Char('.'));
3285  if (idx == -1)
3286  return false;
3287 
3288  int len = domain.size() - idx - 1;
3289  QString tldString(domain.constData() + idx + 1, len);
3290  qt_nameprep(&tldString, 0);
3291 
3292  const QChar *tld = tldString.constData();
3293 
3294  if (user_idn_whitelist)
3295  return user_idn_whitelist->contains(tldString);
3296 
3297  int l = 0;
3298  int r = sizeof(idn_whitelist)/sizeof(const char *) - 1;
3299  int i = (l + r + 1) / 2;
3300 
3301  while (r != l) {
3302  if (lessThan(tld, len, idn_whitelist[i]))
3303  r = i - 1;
3304  else
3305  l = i;
3306  i = (l + r + 1) / 2;
3307  }
3308  return equal(tld, len, idn_whitelist[i]);
3309 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
static bool lessThan(const QChar *a, int l, const char *c)
Definition: qurl.cpp:3253
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
static const char *const idn_whitelist[]
Definition: qurl.cpp:3227
QBool contains(const QString &str, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the list contains the string str; otherwise returns false.
Definition: qstringlist.h:172
static void qt_nameprep(QString *source, int from)
Definition: qurl.cpp:2979
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:3000
QFactoryLoader * l
static QStringList * user_idn_whitelist
Definition: qurl.cpp:3251
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
const QChar * constData() const
Returns a pointer to the data stored in the QString.
Definition: qstring.h:712
static bool equal(const QChar *a, int l, const char *b)
Definition: qurl.cpp:3270

◆ qt_nameprep()

void qt_nameprep ( QString source,
int  from 
)
static

Definition at line 2979 of file qurl.cpp.

Referenced by isBidirectionalL(), qt_ACE_do(), and qt_is_idn_enabled().

2980 {
2981  QChar *src = source->data(); // causes a detach, so we're sure the only one using it
2982  QChar *out = src + from;
2983  const QChar *e = src + source->size();
2984 
2985  for ( ; out < e; ++out) {
2986  register ushort uc = out->unicode();
2987  if (uc >= 0x80) {
2988  break;
2989  } else if (uc >= 'A' && uc <= 'Z') {
2990  *out = QChar(uc | 0x20);
2991  }
2992  }
2993  if (out == e)
2994  return; // everything was mapped easily (lowercased, actually)
2995  int firstNonAscii = out - src;
2996 
2997  // Characters unassigned in Unicode 3.2 are not allowed in "stored string" scheme
2998  // but allowed in "query" scheme
2999  // (Table A.1)
3000  const bool isUnassignedAllowed = false; // ###
3001  // Characters commonly mapped to nothing are simply removed
3002  // (Table B.1)
3003  const QChar *in = out;
3004  for ( ; in < e; ++in) {
3005  uint uc = in->unicode();
3006  if (QChar(uc).isHighSurrogate() && in < e - 1) {
3007  ushort low = in[1].unicode();
3008  if (QChar(low).isLowSurrogate()) {
3009  ++in;
3010  uc = QChar::surrogateToUcs4(uc, low);
3011  }
3012  }
3013  if (!isUnassignedAllowed) {
3015  if (version == QChar::Unicode_Unassigned || version > QChar::Unicode_3_2) {
3016  source->resize(from); // not allowed, clear the label
3017  return;
3018  }
3019  }
3020  if (!isMappedToNothing(uc)) {
3021  if (uc <= 0xFFFF) {
3022  *out++ = *in;
3023  } else {
3024  *out++ = in[-1];
3025  *out++ = in[0];
3026  }
3027  }
3028  }
3029  if (out != in)
3030  source->truncate(out - src);
3031 
3032  // Map to lowercase (Table B.2)
3033  mapToLowerCase(source, firstNonAscii);
3034 
3035  // Normalize to Unicode 3.2 form KC
3037  QChar::UnicodeVersion version, int from);
3039  firstNonAscii > from ? firstNonAscii - 1 : from);
3040 
3041  // Strip prohibited output
3042  if (containsProhibitedOuptut(source, firstNonAscii)) {
3043  source->resize(from);
3044  return;
3045  }
3046 
3047  // Check for valid bidirectional characters
3048  bool containsLCat = false;
3049  bool containsRandALCat = false;
3050  src = source->data();
3051  e = src + source->size();
3052  for (in = src + from; in < e && (!containsLCat || !containsRandALCat); ++in) {
3053  uint uc = in->unicode();
3054  if (QChar(uc).isHighSurrogate() && in < e - 1) {
3055  ushort low = in[1].unicode();
3056  if (QChar(low).isLowSurrogate()) {
3057  ++in;
3058  uc = QChar::surrogateToUcs4(uc, low);
3059  }
3060  }
3061  if (isBidirectionalL(uc))
3062  containsLCat = true;
3063  else if (isBidirectionalRorAL(uc))
3064  containsRandALCat = true;
3065  }
3066  if (containsRandALCat) {
3067  if (containsLCat || (!isBidirectionalRorAL(src[from].unicode())
3068  || !isBidirectionalRorAL(e[-1].unicode())))
3069  source->resize(from); // not allowed, clear the label
3070  }
3071 }
NormalizationForm
This enum describes the various normalized forms of Unicode text.
Definition: qstring.h:309
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
static bool isBidirectionalRorAL(uint uc)
Definition: qurl.cpp:2520
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QChar * data()
Returns a pointer to the data stored in the QString.
Definition: qstring.h:710
static bool isMappedToNothing(uint uc)
Definition: qurl.cpp:2433
UnicodeVersion unicodeVersion() const
Returns the Unicode version that introduced this character.
Definition: qchar.cpp:1189
void truncate(int pos)
Truncates the string at the given position index.
Definition: qstring.cpp:4603
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
static const char * data(const QByteArray &arr)
unsigned int uint
Definition: qglobal.h:996
UnicodeVersion
Specifies which version of the [Unicode standard](http://www.
Definition: qchar.h:212
void resize(int size)
Sets the size of the string to size characters.
Definition: qstring.cpp:1353
static void mapToLowerCase(QString *str, int from)
Definition: qurl.cpp:2388
unsigned short ushort
Definition: qglobal.h:995
static bool containsProhibitedOuptut(const QString *str, int from)
Definition: qurl.cpp:2450
static uint surrogateToUcs4(ushort high, ushort low)
Converts a UTF16 surrogate pair with the given high and low values to its UCS-4 code point...
Definition: qchar.h:297
static bool isBidirectionalL(uint uc)
Definition: qurl.cpp:2560
void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar::UnicodeVersion version, int from)
Definition: qstring.cpp:6710

◆ removeDotsFromPath()

static void removeDotsFromPath ( QByteArray path)
static

Definition at line 3746 of file qurl.cpp.

Referenced by QUrlPrivate::normalized(), and QUrl::resolved().

3747 {
3748  // The input buffer is initialized with the now-appended path
3749  // components and the output buffer is initialized to the empty
3750  // string.
3751  char *out = path->data();
3752  const char *in = out;
3753  const char *end = out + path->size();
3754 
3755  // If the input buffer consists only of
3756  // "." or "..", then remove that from the input
3757  // buffer;
3758  if (path->size() == 1 && in[0] == '.')
3759  ++in;
3760  else if (path->size() == 2 && in[0] == '.' && in[1] == '.')
3761  in += 2;
3762  // While the input buffer is not empty, loop:
3763  while (in < end) {
3764 
3765  // otherwise, if the input buffer begins with a prefix of "../" or "./",
3766  // then remove that prefix from the input buffer;
3767  if (path->size() >= 2 && in[0] == '.' && in[1] == '/')
3768  in += 2;
3769  else if (path->size() >= 3 && in[0] == '.' && in[1] == '.' && in[2] == '/')
3770  in += 3;
3771 
3772  // otherwise, if the input buffer begins with a prefix of
3773  // "/./" or "/.", where "." is a complete path segment,
3774  // then replace that prefix with "/" in the input buffer;
3775  if (in <= end - 3 && in[0] == '/' && in[1] == '.' && in[2] == '/') {
3776  in += 2;
3777  continue;
3778  } else if (in == end - 2 && in[0] == '/' && in[1] == '.') {
3779  *out++ = '/';
3780  in += 2;
3781  break;
3782  }
3783 
3784  // otherwise, if the input buffer begins with a prefix
3785  // of "/../" or "/..", where ".." is a complete path
3786  // segment, then replace that prefix with "/" in the
3787  // input buffer and remove the last //segment and its
3788  // preceding "/" (if any) from the output buffer;
3789  if (in <= end - 4 && in[0] == '/' && in[1] == '.' && in[2] == '.' && in[3] == '/') {
3790  while (out > path->constData() && *(--out) != '/')
3791  ;
3792  if (out == path->constData() && *out != '/')
3793  ++in;
3794  in += 3;
3795  continue;
3796  } else if (in == end - 3 && in[0] == '/' && in[1] == '.' && in[2] == '.') {
3797  while (out > path->constData() && *(--out) != '/')
3798  ;
3799  if (*out == '/')
3800  ++out;
3801  in += 3;
3802  break;
3803  }
3804 
3805  // otherwise move the first path segment in
3806  // the input buffer to the end of the output
3807  // buffer, including the initial "/" character
3808  // (if any) and any subsequent characters up
3809  // to, but not including, the next "/"
3810  // character or the end of the input buffer.
3811  *out++ = *in++;
3812  while (in < end && *in != '/')
3813  *out++ = *in++;
3814  }
3815  path->truncate(out - path->constData());
3816 }
void truncate(int pos)
Truncates the byte array at index position pos.
char * data()
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:429
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402
static const KeyPair *const end

◆ toHex()

static char toHex ( quint8  c)
inlinestatic

Definition at line 4440 of file qurl.cpp.

Referenced by QPdfBaseEnginePrivate::drawTextItem(), QByteArray::isSharedWith(), QSharedMemoryPrivate::makePlatformSafeKey(), QUrlPrivate::setEncodedUrl(), and QTest::toHexRepresentation().

4441 {
4442  return c > 9 ? c - 10 + 'A' : c + '0';
4443 }
unsigned char c[8]
Definition: qnumeric_p.h:62

◆ toPercentEncodingHelper()

static QByteArray toPercentEncodingHelper ( const QString s,
const char *  exclude,
const char *  include = 0 
)
static

Definition at line 233 of file qurl.cpp.

Referenced by QUrl::addQueryItem(), QUrlPrivate::ensureEncodedParts(), QUrl::setQueryItems(), QUrl::setUrl(), and QUrl::toPercentEncoding().

234 {
235  if (s.isNull())
236  return QByteArray(); // null
237  QByteArray ba = s.toUtf8();
238  q_toPercentEncoding(&ba, exclude, include);
239  return ba;
240 }
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
Definition: qstring.cpp:4074
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
bool isNull() const
Returns true if this string is null; otherwise returns false.
Definition: qstring.h:505
void q_toPercentEncoding(QByteArray *ba, const char *exclude, const char *include=0)

◆ toPunycodeHelper()

static void toPunycodeHelper ( const QChar s,
int  ucLength,
QString output 
)
static

Definition at line 3140 of file qurl.cpp.

Referenced by qt_ACE_do(), and QUrl::toPunycode().

3141 {
3142  uint n = initial_n;
3143  uint delta = 0;
3144  uint bias = initial_bias;
3145 
3146  int outLen = output->length();
3147  output->resize(outLen + ucLength);
3148 
3149  QChar *d = output->data() + outLen;
3150  bool skipped = false;
3151  // copy all basic code points verbatim to output.
3152  for (uint j = 0; j < (uint) ucLength; ++j) {
3153  ushort js = s[j].unicode();
3154  if (js < 0x80)
3155  *d++ = js;
3156  else
3157  skipped = true;
3158  }
3159 
3160  // if there were only basic code points, just return them
3161  // directly; don't do any encoding.
3162  if (!skipped)
3163  return;
3164 
3165  output->truncate(d - output->constData());
3166  int copied = output->size() - outLen;
3167 
3168  // h and b now contain the number of basic code points in input.
3169  uint b = copied;
3170  uint h = copied;
3171 
3172  // if basic code points were copied, add the delimiter character.
3173  if (h > 0)
3174  *output += QChar(0x2d);
3175 
3176  // while there are still unprocessed non-basic code points left in
3177  // the input string...
3178  while (h < (uint) ucLength) {
3179  // find the character in the input string with the lowest
3180  // unicode value.
3181  uint m = Q_MAXINT;
3182  uint j;
3183  for (j = 0; j < (uint) ucLength; ++j) {
3184  if (s[j].unicode() >= n && s[j].unicode() < m)
3185  m = (uint) s[j].unicode();
3186  }
3187 
3188  // reject out-of-bounds unicode characters
3189  if (m - n > (Q_MAXINT - delta) / (h + 1)) {
3190  output->truncate(outLen);
3191  return; // punycode_overflow
3192  }
3193 
3194  delta += (m - n) * (h + 1);
3195  n = m;
3196 
3197  // for each code point in the input string
3198  for (j = 0; j < (uint) ucLength; ++j) {
3199 
3200  // increase delta until we reach the character with the
3201  // lowest unicode code. fail if delta overflows.
3202  if (s[j].unicode() < n) {
3203  ++delta;
3204  if (!delta) {
3205  output->truncate(outLen);
3206  return; // punycode_overflow
3207  }
3208  }
3209 
3210  // if j is the index of the character with the lowest
3211  // unicode code...
3212  if (s[j].unicode() == n) {
3213  appendEncode(output, delta, bias, b, h);
3214  }
3215  }
3216 
3217  ++delta;
3218  ++n;
3219  }
3220 
3221  // prepend ACE prefix
3222  output->insert(outLen, QLatin1String("xn--"));
3223  return;
3224 }
double d
Definition: qnumeric_p.h:62
static void appendEncode(QString *output, uint &delta, uint &bias, uint &b, uint &h)
Definition: qurl.cpp:3116
#define Q_MAXINT
Definition: qurl.cpp:267
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
static const uint initial_n
Definition: qurl.cpp:274
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QChar * data()
Returns a pointer to the data stored in the QString.
Definition: qstring.h:710
void truncate(int pos)
Truncates the string at the given position index.
Definition: qstring.cpp:4603
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
unsigned int uint
Definition: qglobal.h:996
void resize(int size)
Sets the size of the string to size characters.
Definition: qstring.cpp:1353
unsigned short ushort
Definition: qglobal.h:995
static const uint initial_bias
Definition: qurl.cpp:273
QString & insert(int i, QChar c)
Definition: qstring.cpp:1671
const QChar * constData() const
Returns a pointer to the data stored in the QString.
Definition: qstring.h:712

Variable Documentation

◆ base

const uint base = 36
static

Definition at line 268 of file qurl.cpp.

Referenced by QScript::AST::ArrayMemberExpression::accept0(), QScript::AST::FieldMemberExpression::accept0(), QScript::AST::NewMemberExpression::accept0(), QScript::AST::CallExpression::accept0(), QScript::AST::PostIncrementExpression::accept0(), QScript::AST::PostDecrementExpression::accept0(), QDeclarativeJS::AST::ArrayMemberExpression::accept0(), QDeclarativeJS::AST::FieldMemberExpression::accept0(), QDeclarativeJS::AST::NewMemberExpression::accept0(), QDeclarativeJS::AST::CallExpression::accept0(), QDeclarativeJS::AST::PostIncrementExpression::accept0(), QDeclarativeJS::AST::PostDecrementExpression::accept0(), QAInterface::actionText(), adapt(), appendEncode(), QPdf::ascii85Encode(), QWSOnScreenSurface::attachToScreen(), QBidiControl::baseLevel(), QBidiControl::basicDirection(), cacheForNamespace(), QGraphicsAnchorLayoutPrivate::changeLayoutVertex(), QAInterface::childAt(), QAInterface::childCount(), QAInterface::className(), QBenchmarkValgrindUtils::cleanup(), QRasterPaintEngine::clip(), QtConcurrent::UnhandledException::clone(), convertPath(), QStyleSheetStyle::defaultSize(), QAInterface::doAction(), QTextLayout::drawCursor(), QPatternist::ResolveURIFN::evaluateSingleton(), QPatternist::BaseURIFN::evaluateSingleton(), QImageTextureGlyphCache::fillTexture(), QDeclarativeJS::AST::ArrayMemberExpression::firstSourceLocation(), QPatternist::AnyURI::fromLexical(), QUrl::fromPunycode(), QFileInfoGatherer::getFileInfos(), QBenchmarkValgrindUtils::getNewestFileName(), QTextStreamPrivate::getNumber(), QAInterface::indexOfChild(), QLCDNumberPrivate::init(), QAInterface::interfaceWrapper(), QString::isSharedWith(), QByteArray::isSharedWith(), QAInterface::isValid(), QPatternist::XsdSchemaChecker::isValidParticleExtension(), isZero(), QString::localeAwareCompare(), QStyleSheetStyle::nativeFrameWidth(), QAInterface::navigate(), QAInterface::object(), QPlainTextEdit::paintEvent(), QTextHtmlParser::parseEntity(), QPatternist::XsdSchemaParser::parseSimpleRestriction(), QTextStreamPrivate::putNumber(), QAInterface::QAInterface(), qDBusGenerateMetaObjectXml(), qForeachContainer(), QFileDialogPrivate::qt_mac_filedialog_event_proc(), qt_mac_flipPixmap(), qt_mix_colors(), qulltoa(), QFontEngineXLFD::recalcAdvances(), QAInterface::rect(), QUnixSocketMessagePrivate::removeBytes(), QAInterface::role(), QScriptEdit::setBaseLineNumber(), QPalette::setBrush(), QRasterPaintEngine::setClipRectInDeviceCoords(), QWSSharedMemSurface::setGeometry(), QTextStream::setIntegerBase(), QWSSharedMemSurface::setPermanentState(), QAInterface::setText(), QObjectPrivate::signalIndex(), QCleanlooksStyle::standardPalette(), QGtkStyle::standardPalette(), QAInterface::state(), QLocalePrivate::stringToLongLong(), QLocalePrivate::stringToUnsLongLong(), QAInterface::text(), QPatternist::AbstractDateTime::timeToString(), QPatternist::XQueryTokenizer::tokenizeCharacterReference(), toUrl(), QAInterface::userActionCount(), QDeclarativeTimeLinePrivate::value(), QTreeWidget::visualItemRect(), and QString::vsprintf().

◆ damp

const uint damp = 700
static

Definition at line 272 of file qurl.cpp.

Referenced by adapt().

◆ fragmentExcludeChars

const char fragmentExcludeChars[] = ABNF_pchar "/?"
static

Definition at line 3548 of file qurl.cpp.

Referenced by QUrlPrivate::ensureEncodedParts(), and QUrlPrivate::normalized().

◆ idn_whitelist

const char* const idn_whitelist[]
static
Initial value:
= {
"ac", "ar", "at",
"biz", "br",
"cat", "ch", "cl", "cn",
"de", "dk",
"es",
"fi",
"gr",
"hu",
"info", "io", "is",
"jp",
"kr",
"li", "lt",
"museum",
"no",
"org",
"se", "sh",
"th", "tm", "tw",
"vn",
"xn--mgbaam7a8h",
"xn--mgberp4a5d4ar",
"xn--wgbh1c"
}

Definition at line 3227 of file qurl.cpp.

Referenced by QUrl::idnWhitelist(), and qt_is_idn_enabled().

◆ initial_bias

const uint initial_bias = 72
static

Definition at line 273 of file qurl.cpp.

Referenced by QUrl::fromPunycode(), and toPunycodeHelper().

◆ initial_n

const uint initial_n = 128
static

Definition at line 274 of file qurl.cpp.

Referenced by QUrl::fromPunycode(), and toPunycodeHelper().

◆ NameprepCaseFolding

const NameprepCaseFoldingEntry NameprepCaseFolding[]
static

Definition at line 1014 of file qurl.cpp.

Referenced by mapToLowerCase().

◆ passwordExcludeChars

const char passwordExcludeChars[] = ABNF_sub_delims ":"
static

Definition at line 3545 of file qurl.cpp.

Referenced by QUrlPrivate::ensureEncodedParts(), and QUrlPrivate::normalized().

◆ pathExcludeChars

const char pathExcludeChars[] = ABNF_pchar "/"
static

Definition at line 3546 of file qurl.cpp.

Referenced by QUrlPrivate::ensureEncodedParts(), and QUrlPrivate::normalized().

◆ queryExcludeChars

const char queryExcludeChars[] = ABNF_pchar "/?"
static

◆ skew

const uint skew = 38
static

Definition at line 271 of file qurl.cpp.

Referenced by adapt().

◆ tmax

const uint tmax = 26
static

Definition at line 270 of file qurl.cpp.

Referenced by adapt(), appendEncode(), and QUrl::fromPunycode().

◆ tmin

const uint tmin = 1
static

Definition at line 269 of file qurl.cpp.

Referenced by adapt(), and QUrl::fromPunycode().

◆ user_idn_whitelist

QStringList* user_idn_whitelist = 0
static

Definition at line 3251 of file qurl.cpp.

Referenced by QUrl::idnWhitelist().

◆ userNameExcludeChars

const char userNameExcludeChars[] = ABNF_sub_delims
static

Definition at line 3544 of file qurl.cpp.

Referenced by QUrlPrivate::ensureEncodedParts(), and QUrlPrivate::normalized().