Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qurl.cpp File Reference

(fd36609064dd978964a615246d09f60eb307bd38)

#include "qurl.h"
#include "qurl_p.h"
#include "qplatformdefs.h"
#include "qstring.h"
#include "qstringlist.h"
#include "qdebug.h"
#include "qhash.h"
#include "qdatastream.h"
#include "private/qipaddress_p.h"
#include "qurlquery.h"
#include "private/qdir_p.h"
#include <private/qtools_p.h>
+ Include dependency graph for qurl.cpp:

Go to the source code of this file.

Classes

class  QUrlPrivate
 
struct  QUrlPrivate::Error
 

Functions

static bool isHex (char c)
 
static QString ftpScheme ()
 
static QString fileScheme ()
 
static QString webDavScheme ()
 
static QString webDavSslTag ()
 
static void parseDecodedComponent (QString &data)
 
static QString recodeFromUser (const QString &input, const ushort *actions, qsizetype from, qsizetype to)
 
static void appendToUser (QString &appendTo, QStringView value, QUrl::FormattingOptions options, const ushort *actions)
 
static const QCharparseIpFuture (QString &host, const QChar *begin, const QChar *end, QUrl::ParsingMode mode)
 
static const QCharparseIp6 (QString &host, const QChar *begin, const QChar *end, QUrl::ParsingMode mode)
 
static void removeDotsFromPath (QString *path)
 
Qt::weak_ordering compareThreeWay (const QUrl &lhs, const QUrl &rhs)
 
bool comparesEqual (const QUrl &lhs, const QUrl &rhs)
 
static QString fromNativeSeparators (const QString &pathName)
 
QDebug operator<< (QDebug d, const QUrl &url)
 
static QString errorMessage (QUrlPrivate::ErrorCode errorCode, const QString &errorSource, qsizetype errorPosition)
 
static void appendComponentIfPresent (QString &msg, bool present, const char *componentName, const QString &component)
 
static QUrl adjustFtpPath (QUrl url)
 
static bool isIp6 (const QString &text)
 

Variables

static const ushort userNameInIsolation []
 
static const ushort *const passwordInIsolation = userNameInIsolation + 1
 
static const ushort *const pathInIsolation = userNameInIsolation + 5
 
static const ushort *const queryInIsolation = userNameInIsolation + 6
 
static const ushort *const fragmentInIsolation = userNameInIsolation + 7
 
static const ushort userNameInUserInfo []
 
static const ushort *const passwordInUserInfo = userNameInUserInfo + 1
 
static const ushort userNameInAuthority []
 
static const ushort *const passwordInAuthority = userNameInAuthority + 1
 
static const ushort userNameInUrl []
 
static const ushort *const passwordInUrl = userNameInUrl + 1
 
static const ushort *const pathInUrl = userNameInUrl + 5
 
static const ushort *const queryInUrl = userNameInUrl + 6
 
static const ushort *const fragmentInUrl = userNameInUrl + 6
 

Function Documentation

◆ adjustFtpPath()

static QUrl adjustFtpPath ( QUrl url)
static

Definition at line 3701 of file qurl.cpp.

References ftpScheme(), QStringView::mid(), QUrl::path(), QUrl::PrettyDecoded, QUrl::scheme(), QUrl::setPath(), QUrl::TolerantMode, and url.

Referenced by QUrl::fromUserInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ appendComponentIfPresent()

static void appendComponentIfPresent ( QString & msg,
bool present,
const char * componentName,
const QString & component )
inlinestatic

Definition at line 3584 of file qurl.cpp.

References component().

Referenced by QUrl::errorString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ appendToUser()

static void appendToUser ( QString & appendTo,
QStringView value,
QUrl::FormattingOptions options,
const ushort * actions )
inlinestatic

Definition at line 822 of file qurl.cpp.

References QString::detach(), QString::isNull(), QUrl::PrettyDecoded, and qt_urlRecode().

Referenced by QUrlPrivate::appendFragment(), QUrlPrivate::appendPassword(), QUrlPrivate::appendPath(), QUrlPrivate::appendQuery(), and QUrlPrivate::appendUserName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ comparesEqual()

bool comparesEqual ( const QUrl & lhs,
const QUrl & rhs )

Definition at line 3143 of file qurl.cpp.

◆ compareThreeWay()

Qt::weak_ordering compareThreeWay ( const QUrl & lhs,
const QUrl & rhs )

Definition at line 3079 of file qurl.cpp.

Referenced by QtPrivate::CompareThreeWayTester::compareThreeWayNoexcept(), and qCompareThreeWay().

+ Here is the caller graph for this function:

◆ errorMessage()

static QString errorMessage ( QUrlPrivate::ErrorCode errorCode,
const QString & errorSource,
qsizetype errorPosition )
static

Definition at line 3517 of file qurl.cpp.

References QUrlPrivate::AuthorityAbsentAndPathIsDoubleSlash, QUrlPrivate::AuthorityPresentAndPathIsRelative, QUrlPrivate::HostMissingEndBracket, QUrlPrivate::InvalidCharacterInIPv6Error, QUrlPrivate::InvalidFragmentError, QUrlPrivate::InvalidIPv4AddressError, QUrlPrivate::InvalidIPv6AddressError, QUrlPrivate::InvalidIPvFutureError, QUrlPrivate::InvalidPasswordError, QUrlPrivate::InvalidPathError, QUrlPrivate::InvalidPortError, QUrlPrivate::InvalidQueryError, QUrlPrivate::InvalidRegNameError, QUrlPrivate::InvalidSchemeError, QUrlPrivate::InvalidUserNameError, QUrlPrivate::NoError, QUrlPrivate::PortEmptyError, QStringLiteral, and QUrlPrivate::RelativeUrlPathContainsColonBeforeSlash.

Referenced by QQmlJS::Dom::JsFile::JsFile(), QQmlJS::Dom::QmlFile::QmlFile(), QQuickVisualTestUtils::QQuickApplicationHelper::QQuickApplicationHelper(), QNetworkReplyHttpImplPrivate::_q_error(), QQnxImageCapture::capture(), QQuickVisualTestUtils::compareImages(), QQmlComponentPrivate::completeLoadFromModule(), QQmlJS::AST::PatternElement::convertLiteralToAssignmentPattern(), QQmlJS::AST::ArrayPattern::convertLiteralToAssignmentPattern(), QQmlJS::AST::ObjectPattern::convertLiteralToAssignmentPattern(), QQmlJS::AST::PatternProperty::convertLiteralToAssignmentPattern(), QWindowsShellItem::copyData(), createDirectory(), QQuickAbstractAnimationPrivate::createProperty(), createSymbolicLink(), createTemporaryItemCopy(), QQuickPropertyAnimation::createTransitionActions(), deploy(), deployPlugin(), deployTranslations(), deployWebEngineCore(), deployWebProcess(), QWindowsNativeOpenFileDialog::dialogResult(), AVFImageCapture::doCapture(), QNetworkReplyHttpImplPrivate::error(), QNetworkReplyImplPrivate::error(), QUrl::errorString(), findDependentLibraries(), findDependentQtLibraries(), findPluginNames(), findSharedLibraries(), QOpenGLConfig::gpuFeatures(), QOpenGLConfig::gpuFeatures(), QQuickTest::initView(), QV4::ExecutableCompilationUnit::instantiate(), itemToDialogUrl(), QMimeXMLProvider::load(), main(), QDomDocument::ParseResult::operator bool(), QMimeTypeParserBase::parse(), parseArguments(), parseEarlyArguments(), QMimeTypeParserBase::parseNumber(), patchQtCore(), Http2::qt_error(), queryQtPaths(), readGpuFeatures(), readGpuFeatures(), readGpuFeatures(), readPeExecutable(), runProcess(), runQmlImportScanner(), QNearFieldManager::stopTargetDetection(), updateFile(), updateFile(), updateFile(), updateLibrary(), and RCCFileInfo::writeDataBlob().

◆ fileScheme()

static QString fileScheme ( )
inlinestatic

Definition at line 425 of file qurl.cpp.

References QStringLiteral.

Referenced by QUrl::fromLocalFile(), QAndroidPlatformServices::openUrl(), and QUrlPrivate::setScheme().

+ Here is the caller graph for this function:

◆ fromNativeSeparators()

static QString fromNativeSeparators ( const QString & pathName)
static

Definition at line 3317 of file qurl.cpp.

References i.

Referenced by QUrl::fromLocalFile().

+ Here is the caller graph for this function:

◆ ftpScheme()

static QString ftpScheme ( )
inlinestatic

Definition at line 420 of file qurl.cpp.

References QStringLiteral.

Referenced by adjustFtpPath(), and QUrl::fromUserInput().

+ Here is the caller graph for this function:

◆ isHex()

static bool isHex ( char c)
inlinestatic

Definition at line 414 of file qurl.cpp.

References QtMiscUtils::isAsciiDigit().

Referenced by QUrlPrivate::validateComponent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isIp6()

static bool isIp6 ( const QString & text)
static

Definition at line 3711 of file qurl.cpp.

References QString::begin(), QString::end(), QString::isEmpty(), QIPAddressUtils::parseIp6(), and text.

Referenced by QUrl::fromUserInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<<()

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

Definition at line 3509 of file qurl.cpp.

References d, QUrl::toDisplayString(), and url.

+ Here is the call graph for this function:

◆ parseDecodedComponent()

static void parseDecodedComponent ( QString & data)
inlinestatic

Definition at line 803 of file qurl.cpp.

Referenced by QUrl::setFragment(), QUrl::setHost(), QUrl::setPassword(), QUrl::setPath(), QUrl::setQuery(), and QUrl::setUserName().

+ Here is the caller graph for this function:

◆ parseIp6()

static const QChar * parseIp6 ( QString & host,
const QChar * begin,
const QChar * end,
QUrl::ParsingMode mode )
static

Definition at line 1227 of file qurl.cpp.

References begin(), QStringView::constBegin(), QStringView::constEnd(), decode, QStringView::indexOf(), QStringView::isEmpty(), QStringView::lastIndexOf(), QStringView::mid(), QIPAddressUtils::parseIp6(), QUrl::PrettyDecoded, qt_urlRecode(), QString::reserve(), ret, QString::size(), QUrl::TolerantMode, QIPAddressUtils::toString(), and QStringView::truncate().

Referenced by is_valid_domain_name(), QHostAddressPrivate::parse(), and QUrlPrivate::setHost().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseIpFuture()

static const QChar * parseIpFuture ( QString & host,
const QChar * begin,
const QChar * end,
QUrl::ParsingMode mode )
static

Definition at line 1182 of file qurl.cpp.

References begin(), QString::constBegin(), QString::constEnd(), QUrl::FullyDecoded, QtMiscUtils::isAsciiLetterOrNumber(), QString::isEmpty(), QtMiscUtils::isHexDigit(), qt_urlRecode(), QString::size(), and QUrl::TolerantMode.

Referenced by QUrlPrivate::setHost().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ recodeFromUser()

static QString recodeFromUser ( const QString & input,
const ushort * actions,
qsizetype from,
qsizetype to )
inlinestatic

Definition at line 809 of file qurl.cpp.

References begin(), output, and qt_urlRecode().

Referenced by QUrlPrivate::setFragment(), QUrlPrivate::setPassword(), QUrlPrivate::setPath(), QUrlPrivate::setQuery(), and QUrlPrivate::setUserName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeDotsFromPath()

static void removeDotsFromPath ( QString * path)
static

Definition at line 1533 of file qurl.cpp.

References out.

Referenced by QUrl::resolved().

+ Here is the caller graph for this function:

◆ webDavScheme()

static QString webDavScheme ( )
inlinestatic

Definition at line 430 of file qurl.cpp.

References QStringLiteral.

Referenced by QUrl::fromLocalFile(), QUrlPrivate::setScheme(), and QUrlPrivate::toLocalFile().

+ Here is the caller graph for this function:

◆ webDavSslTag()

static QString webDavSslTag ( )
inlinestatic

Definition at line 435 of file qurl.cpp.

References QStringLiteral.

Referenced by QUrl::fromLocalFile(), and QUrlPrivate::toLocalFile().

+ Here is the caller graph for this function:

Variable Documentation

◆ fragmentInIsolation

const ushort* const fragmentInIsolation = userNameInIsolation + 7
static

Definition at line 742 of file qurl.cpp.

Referenced by QUrlPrivate::appendFragment(), and QUrlPrivate::setFragment().

◆ fragmentInUrl

const ushort* const fragmentInUrl = userNameInUrl + 6
static

Definition at line 801 of file qurl.cpp.

Referenced by QUrlPrivate::appendFragment().

◆ passwordInAuthority

const ushort* const passwordInAuthority = userNameInAuthority + 1
static

Definition at line 784 of file qurl.cpp.

Referenced by QUrlPrivate::appendUserInfo().

◆ passwordInIsolation

const ushort* const passwordInIsolation = userNameInIsolation + 1
static

Definition at line 739 of file qurl.cpp.

Referenced by QUrlPrivate::appendPassword(), and QUrlPrivate::setPassword().

◆ passwordInUrl

const ushort* const passwordInUrl = userNameInUrl + 1
static

Definition at line 798 of file qurl.cpp.

Referenced by QUrlPrivate::appendPassword(), and QUrlPrivate::appendUserInfo().

◆ passwordInUserInfo

const ushort* const passwordInUserInfo = userNameInUserInfo + 1
static

Definition at line 763 of file qurl.cpp.

Referenced by QUrlPrivate::appendUserInfo().

◆ pathInIsolation

const ushort* const pathInIsolation = userNameInIsolation + 5
static

Definition at line 740 of file qurl.cpp.

Referenced by QUrlPrivate::appendPath(), and QUrlPrivate::setPath().

◆ pathInUrl

const ushort* const pathInUrl = userNameInUrl + 5
static

Definition at line 799 of file qurl.cpp.

Referenced by QUrlPrivate::appendPath().

◆ queryInIsolation

const ushort* const queryInIsolation = userNameInIsolation + 6
static

Definition at line 741 of file qurl.cpp.

Referenced by QUrlPrivate::appendQuery(), and QUrlPrivate::setQuery().

◆ queryInUrl

const ushort* const queryInUrl = userNameInUrl + 6
static

Definition at line 800 of file qurl.cpp.

Referenced by QUrlPrivate::appendQuery().

◆ userNameInAuthority

const ushort userNameInAuthority[]
static
Initial value:
= {
encode(':'),
encode('@'),
encode(']'),
encode('['),
decode('/'),
decode('?'),
decode('#'),
decode('"'),
decode('<'),
decode('>'),
decode('^'),
decode('\\'),
decode('|'),
decode('{'),
decode('}'),
0
}
#define decode(x)
#define encode(x)

Definition at line 765 of file qurl.cpp.

Referenced by QUrlPrivate::appendUserInfo().

◆ userNameInIsolation

const ushort userNameInIsolation[]
static
Initial value:
= {
decode(':'),
decode('@'),
decode(']'),
decode('['),
decode('/'),
decode('?'),
decode('#'),
decode('"'),
decode('<'),
decode('>'),
decode('^'),
decode('\\'),
decode('|'),
decode('{'),
decode('}'),
0
}

Definition at line 720 of file qurl.cpp.

Referenced by QUrlPrivate::appendUserName(), and QUrlPrivate::setUserName().

◆ userNameInUrl

const ushort userNameInUrl[]
static
Initial value:
= {
encode(':'),
encode('@'),
encode(']'),
encode('['),
encode('/'),
encode('?'),
encode('#'),
0
}

Definition at line 786 of file qurl.cpp.

Referenced by QUrlPrivate::appendUserInfo(), and QUrlPrivate::appendUserName().

◆ userNameInUserInfo

const ushort userNameInUserInfo[]
static
Initial value:
= {
encode(':'),
decode('@'),
decode(']'),
decode('['),
decode('/'),
decode('?'),
decode('#'),
decode('"'),
decode('<'),
decode('>'),
decode('^'),
decode('\\'),
decode('|'),
decode('{'),
decode('}'),
0
}

Definition at line 744 of file qurl.cpp.

Referenced by QUrlPrivate::appendUserInfo().