Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qurl.cpp File Reference
#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)
 
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 3687 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 3570 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 820 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:

◆ errorMessage()

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

Definition at line 3503 of file qurl.cpp.

References QString::at(), 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, QChar::Null, QUrlPrivate::PortEmptyError, QStringLiteral, QUrlPrivate::RelativeUrlPathContainsColonBeforeSlash, and QString::size().

Referenced by QQuickVisualTestUtils::QQuickApplicationHelper::QQuickApplicationHelper(), QNetworkReplyHttpImplPrivate::_q_error(), QQnxImageCapture::capture(), QQuickVisualTestUtils::compareImages(), 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(), 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(), qMakeFieldInfo(), qMakeFieldInfo(), Http2::qt_error(), queryQtPaths(), readElfExecutable(), readExecutable(), readGpuFeatures(), readGpuFeatures(), readGpuFeatures(), readPeExecutable(), runProcess(), runQmlImportScanner(), QNearFieldManager::stopTargetDetection(), updateFile(), updateFile(), updateFile(), updateLibrary(), and RCCFileInfo::writeDataBlob().

+ Here is the call graph for this function:

◆ fileScheme()

static QString fileScheme ( )
inlinestatic

Definition at line 423 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 3303 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 418 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 412 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 3697 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 3495 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 801 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 1221 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(), QStringView::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 1176 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 807 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 1525 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 428 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 433 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 740 of file qurl.cpp.

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

◆ fragmentInUrl

const ushort* const fragmentInUrl = userNameInUrl + 6
static

Definition at line 799 of file qurl.cpp.

Referenced by QUrlPrivate::appendFragment().

◆ passwordInAuthority

const ushort* const passwordInAuthority = userNameInAuthority + 1
static

Definition at line 782 of file qurl.cpp.

Referenced by QUrlPrivate::appendUserInfo().

◆ passwordInIsolation

const ushort* const passwordInIsolation = userNameInIsolation + 1
static

Definition at line 737 of file qurl.cpp.

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

◆ passwordInUrl

const ushort* const passwordInUrl = userNameInUrl + 1
static

Definition at line 796 of file qurl.cpp.

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

◆ passwordInUserInfo

const ushort* const passwordInUserInfo = userNameInUserInfo + 1
static

Definition at line 761 of file qurl.cpp.

Referenced by QUrlPrivate::appendUserInfo().

◆ pathInIsolation

const ushort* const pathInIsolation = userNameInIsolation + 5
static

Definition at line 738 of file qurl.cpp.

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

◆ pathInUrl

const ushort* const pathInUrl = userNameInUrl + 5
static

Definition at line 797 of file qurl.cpp.

Referenced by QUrlPrivate::appendPath().

◆ queryInIsolation

const ushort* const queryInIsolation = userNameInIsolation + 6
static

Definition at line 739 of file qurl.cpp.

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

◆ queryInUrl

const ushort* const queryInUrl = userNameInUrl + 6
static

Definition at line 798 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 763 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 718 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 784 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 742 of file qurl.cpp.

Referenced by QUrlPrivate::appendUserInfo().