diff options
author | David Faure <faure@kde.org> | 2012-01-25 18:03:37 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-26 15:23:36 +0100 |
commit | e7c0fcbec4876762622a8815718f42de3214524c (patch) | |
tree | b70112aa87103cf084ea6012ccc9998a3d34cdb3 /src/corelib/io/qurl.cpp | |
parent | 4408bae29ac6cce4dc7eb1adf4905662ffe79ad0 (diff) |
QUrl: Implement a number of ## Qt5 TODOs (merging overloads)
Change-Id: I629c20f10e3667937d488ea30f93bf86f980ee1a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qurl.cpp')
-rw-r--r-- | src/corelib/io/qurl.cpp | 86 |
1 files changed, 17 insertions, 69 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 9856d5defa..b9430c6417 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -4179,6 +4179,8 @@ QString QUrlPrivate::createErrorString() readable representation, with no percent encoding. QUrl will automatically percent encode all characters that are not allowed in a URL. + The parsing mode \a parsingMode is used for parsing \a url. + Example: \snippet doc/src/snippets/code/src_corelib_io_qurl.cpp 0 @@ -4189,19 +4191,6 @@ QString QUrlPrivate::createErrorString() \sa setUrl(), setEncodedUrl(), fromEncoded(), TolerantMode */ -QUrl::QUrl(const QString &url) : d(0) -{ - if (!url.isEmpty()) - setUrl(url); -} - -/*! - \overload - - Parses the \a url using the parser mode \a parsingMode. - - \sa setUrl() -*/ QUrl::QUrl(const QString &url, ParsingMode parsingMode) : d(0) { if (!url.isEmpty()) @@ -4294,23 +4283,13 @@ void QUrl::clear() \a url is assumed to be in unicode format, with no percent encoding. + The parsing mode \a parsingMode is used for parsing \a url. + Calling isValid() will tell whether or not a valid URL was constructed. \sa setEncodedUrl() */ -void QUrl::setUrl(const QString &url) -{ - setUrl(url, TolerantMode); -} - -/*! - \overload - - Parses \a url using the parsing mode \a parsingMode. - - \sa setEncodedUrl() -*/ void QUrl::setUrl(const QString &url, ParsingMode parsingMode) { detach(); @@ -4353,21 +4332,6 @@ void QUrl::setUrl(const QString &url, ParsingMode parsingMode) setEncodedUrl(encodedUrl, StrictMode); } -/*! - Constructs a URL by parsing the contents of \a encodedUrl. - - \a encodedUrl is assumed to be a URL string in percent encoded - form, containing only ASCII characters. - - Use isValid() to determine if a valid URL was constructed. - - \sa setUrl() -*/ -void QUrl::setEncodedUrl(const QByteArray &encodedUrl) -{ - setEncodedUrl(encodedUrl, TolerantMode); -} - inline static bool isHex(char c) { c |= 0x20; @@ -4380,8 +4344,16 @@ static inline char toHex(quint8 c) } /*! - Constructs a URL by parsing the contents of \a encodedUrl using - the given \a parsingMode. + Constructs a URL by parsing the contents of \a encodedUrl. + + \a encodedUrl is assumed to be a URL string in percent encoded + form, containing only ASCII characters. + + The parsing mode \a parsingMode is used for parsing \a encodedUrl. + + Use isValid() to determine if a valid URL was constructed. + + \sa setUrl() */ void QUrl::setEncodedUrl(const QByteArray &encodedUrl, ParsingMode parsingMode) { @@ -4808,18 +4780,6 @@ void QUrl::setPort(int port) } /*! - Returns the port of the URL, or -1 if the port is unspecified. -*/ -int QUrl::port() const -{ - if (!d) return -1; - if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse(); - if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Validated)) d->validate(); - return d->port; -} - -/*! - \overload \since 4.1 Returns the port of the URL, or \a defaultPort if the port is @@ -5701,6 +5661,8 @@ bool QUrl::isRelative() const URL. The output can be customized by passing flags with \a options. + The resulting QString can be passed back to a QUrl later on. + \sa FormattingOptions, toEncoded() */ QString QUrl::toString(FormattingOptions options) const @@ -5765,21 +5727,7 @@ QByteArray QUrl::toEncoded(FormattingOptions options) const Parses \a input and returns the corresponding QUrl. \a input is assumed to be in encoded form, containing only ASCII characters. - The URL is parsed using TolerantMode. - - \sa toEncoded(), setUrl() -*/ -QUrl QUrl::fromEncoded(const QByteArray &input) -{ - QUrl tmp; - tmp.setEncodedUrl(input, TolerantMode); - return tmp; -} - -/*! - \overload - - Parses the URL using \a parsingMode. + The URL is parsed using \a parsingMode. \sa toEncoded(), setUrl() */ |