diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 5fd3dcf55b..a3fbf333e7 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -1565,6 +1565,20 @@ void QUrl::setUrl(const QString &url, ParsingMode parsingMode) } } +/*! + \fn void QUrl::setEncodedUrl(const QByteArray &encodedUrl, ParsingMode parsingMode) + \deprecated + 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. + + \obsolete Use setUrl(QString::fromUtf8(encodedUrl), parsingMode) + + \sa setUrl() +*/ /*! Sets the scheme of the URL to \a scheme. As a scheme can only @@ -1803,6 +1817,35 @@ QString QUrl::userName(ComponentFormattingOptions options) const return result; } +/*! + \fn void QUrl::setEncodedUserName(const QByteArray &userName) + \deprecated + \since 4.4 + + Sets the URL's user name to the percent-encoded \a userName. The \a + userName is part of the user info element in the authority of the + URL, as described in setUserInfo(). + + Note: this function does not verify that \a userName is properly + encoded. It is the caller's responsibility to ensure that the any + delimiters (such as colons or slashes) are properly encoded. + + \sa setUserName(), encodedUserName(), setUserInfo() +*/ + +/*! + \fn QByteArray QUrl::encodedUserName() const + \deprecated + \since 4.4 + + Returns the user name of the URL if it is defined; otherwise + an empty string is returned. The returned value will have its + non-ASCII and other control characters percent-encoded, as in + toEncoded(). + + \sa setEncodedUserName() +*/ + /*! Sets the URL's password to \a password. The \a password is part of the user info element in the authority of the URL, as described in @@ -1864,6 +1907,35 @@ QString QUrl::password(ComponentFormattingOptions options) const return result; } +/*! + \fn void QUrl::setEncodedPassword(const QByteArray &password) + \deprecated + \since 4.4 + + Sets the URL's password to the percent-encoded \a password. The \a + password is part of the user info element in the authority of the + URL, as described in setUserInfo(). + + Note: this function does not verify that \a password is properly + encoded. It is the caller's responsibility to ensure that the any + delimiters (such as colons or slashes) are properly encoded. + + \sa setPassword(), encodedPassword(), setUserInfo() +*/ + +/*! + \fn QByteArray QUrl::encodedPassword() const + \deprecated + \since 4.4 + + Returns the password of the URL if it is defined; otherwise an + empty string is returned. The returned value will have its + non-ASCII and other control characters percent-encoded, as in + toEncoded(). + + \sa setEncodedPassword(), toEncoded() +*/ + /*! Sets the host of the URL to \a host. The host is part of the authority. @@ -1941,6 +2013,36 @@ QString QUrl::host(ComponentFormattingOptions options) const return result; } +/*! + \fn void QUrl::setEncodedHost(const QByteArray &host) + \deprecated + \since 4.4 + + Sets the URL's host to the ACE- or percent-encoded \a host. The \a + host is part of the user info element in the authority of the + URL, as described in setAuthority(). + + \sa setHost(), encodedHost(), setAuthority(), fromAce() +*/ + +/*! + \fn QByteArray QUrl::encodedHost() const + \deprecated + \since 4.4 + + Returns the host part of the URL if it is defined; otherwise + an empty string is returned. + + Note: encodedHost() does not return percent-encoded hostnames. Instead, + the ACE-encoded (bare ASCII in Punycode encoding) form will be + returned for any non-ASCII hostname. + + This function is equivalent to calling QUrl::toAce() on the return + value of host(). + + \sa setEncodedHost() +*/ + /*! Sets the port of the URL to \a port. The port is part of the authority of the URL, as described in setAuthority(). @@ -2046,6 +2148,42 @@ QString QUrl::path(ComponentFormattingOptions options) const return result; } +/*! + \fn void QUrl::setEncodedPath(const QByteArray &path) + \deprecated + \since 4.4 + + Sets the URL's path to the percent-encoded \a path. The path is + the part of the URL that comes after the authority but before the + query string. + + \image qurl-ftppath.png + + For non-hierarchical schemes, the path will be everything + following the scheme declaration, as in the following example: + + \image qurl-mailtopath.png + + Note: this function does not verify that \a path is properly + encoded. It is the caller's responsibility to ensure that the any + delimiters (such as '?' and '#') are properly encoded. + + \sa setPath(), encodedPath(), setUserInfo() +*/ + +/*! + \fn QByteArray QUrl::encodedPath() const + \deprecated + \since 4.4 + + Returns the path of the URL if it is defined; otherwise an + empty string is returned. The returned value will have its + non-ASCII and other control characters percent-encoded, as in + toEncoded(). + + \sa setEncodedPath(), toEncoded() +*/ + /*! \since 4.2 @@ -2105,6 +2243,28 @@ void QUrl::setQuery(const QString &query, ParsingMode mode) d->sectionIsPresent &= ~QUrlPrivate::Query; } +/*! + \fn void QUrl::setEncodedQuery(const QByteArray &query) + \deprecated + + Sets the query string of the URL to \a query. The string is + inserted as-is, and no further encoding is performed when calling + toEncoded(). + + This function is useful if you need to pass a query string that + does not fit into the key-value pattern, or that uses a different + scheme for encoding special characters than what is suggested by + QUrl. + + Passing a value of QByteArray() to \a query (a null QByteArray) unsets + the query completely. However, passing a value of QByteArray("") + will set the query to an empty value, as if the original URL + had a lone "?". + + \sa encodedQuery(), hasQuery() +*/ + + /*! \overload \since 5.0 @@ -2128,6 +2288,244 @@ void QUrl::setQuery(const QUrlQuery &query) d->sectionIsPresent |= QUrlPrivate::Query; } +/*! + \fn void QUrl::setQueryItems(const QList > &query) + \deprecated + + Sets the query string of the URL to an encoded version of \a + query. The contents of \a query are converted to a string + internally, each pair delimited by the character returned by + pairDelimiter(), and the key and value are delimited by + valueDelimiter(). + + \note This method does not encode spaces (ASCII 0x20) as plus (+) signs, + like HTML forms do. If you need that kind of encoding, you must encode + the value yourself and use QUrl::setEncodedQueryItems. + + \sa setQueryDelimiters(), queryItems(), setEncodedQueryItems() +*/ + +/*! + \fn void QUrl::setEncodedQueryItems(const QList > &query) + \deprecated + \since 4.4 + + Sets the query string of the URL to the encoded version of \a + query. The contents of \a query are converted to a string + internally, each pair delimited by the character returned by + pairDelimiter(), and the key and value are delimited by + valueDelimiter(). + + Note: this function does not verify that the key-value pairs + are properly encoded. It is the caller's responsibility to ensure + that the query delimiters are properly encoded, if any. + + \sa setQueryDelimiters(), encodedQueryItems(), setQueryItems() +*/ + +/*! + \fn void QUrl::addQueryItem(const QString &key, const QString &value) + \deprecated + + Inserts the pair \a key = \a value into the query string of the + URL. + + The key/value pair is encoded before it is added to the query. The + pair is converted into separate strings internally. The \a key and + \a value is first encoded into UTF-8 and then delimited by the + character returned by valueDelimiter(). Each key/value pair is + delimited by the character returned by pairDelimiter(). + + \note This method does not encode spaces (ASCII 0x20) as plus (+) signs, + like HTML forms do. If you need that kind of encoding, you must encode + the value yourself and use QUrl::addEncodedQueryItem. + + \sa addEncodedQueryItem() +*/ + +/*! + \fn void QUrl::addEncodedQueryItem(const QByteArray &key, const QByteArray &value) + \deprecated + \since 4.4 + + Inserts the pair \a key = \a value into the query string of the + URL. + + Note: this function does not verify that either \a key or \a value + are properly encoded. It is the caller's responsibility to ensure + that the query delimiters are properly encoded, if any. + + \sa addQueryItem(), setQueryDelimiters() +*/ + +/*! + \fn QList > QUrl::queryItems() const + \deprecated + + Returns the query string of the URL, as a map of keys and values. + + \note This method does not decode spaces plus (+) signs as spaces (ASCII + 0x20), like HTML forms do. If you need that kind of decoding, you must + use QUrl::encodedQueryItems and decode the data yourself. + + \sa setQueryItems(), setEncodedQuery() +*/ + +/*! + \fn QList > QUrl::encodedQueryItems() const + \deprecated + \since 4.4 + + Returns the query string of the URL, as a map of encoded keys and values. + + \sa setEncodedQueryItems(), setQueryItems(), setEncodedQuery() +*/ + +/*! + \fn bool QUrl::hasQueryItem(const QString &key) const + \deprecated + + Returns true if there is a query string pair whose key is equal + to \a key from the URL. + + \sa hasEncodedQueryItem() +*/ + +/*! + \fn bool QUrl::hasEncodedQueryItem(const QByteArray &key) const + \deprecated + \since 4.4 + + Returns true if there is a query string pair whose key is equal + to \a key from the URL. + + Note: if the encoded \a key does not match the encoded version of + the query, this function will return false. That is, if the + encoded query of this URL is "search=Qt%20Rules", calling this + function with \a key = "%73earch" will return false. + + \sa hasQueryItem() +*/ + +/*! + \fn QString QUrl::queryItemValue(const QString &key) const + \deprecated + + Returns the first query string value whose key is equal to \a key + from the URL. + + \note This method does not decode spaces plus (+) signs as spaces (ASCII + 0x20), like HTML forms do. If you need that kind of decoding, you must + use QUrl::encodedQueryItemValue and decode the data yourself. + + \sa allQueryItemValues() +*/ + +/*! + \fn QByteArray QUrl::encodedQueryItemValue(const QByteArray &key) const + \deprecated + \since 4.4 + + Returns the first query string value whose key is equal to \a key + from the URL. + + Note: if the encoded \a key does not match the encoded version of + the query, this function will not work. That is, if the + encoded query of this URL is "search=Qt%20Rules", calling this + function with \a key = "%73earch" will return an empty string. + + \sa queryItemValue(), allQueryItemValues() +*/ + +/*! + \fn QStringList QUrl::allQueryItemValues(const QString &key) const + \deprecated + + Returns the a list of query string values whose key is equal to + \a key from the URL. + + \note This method does not decode spaces plus (+) signs as spaces (ASCII + 0x20), like HTML forms do. If you need that kind of decoding, you must + use QUrl::allEncodedQueryItemValues and decode the data yourself. + + \sa queryItemValue() +*/ + +/*! + \fn QList QUrl::allEncodedQueryItemValues(const QByteArray &key) const + \deprecated + \since 4.4 + + Returns the a list of query string values whose key is equal to + \a key from the URL. + + Note: if the encoded \a key does not match the encoded version of + the query, this function will not work. That is, if the + encoded query of this URL is "search=Qt%20Rules", calling this + function with \a key = "%73earch" will return an empty list. + + \sa allQueryItemValues(), queryItemValue(), encodedQueryItemValue() +*/ + +/*! + \fn void QUrl::removeQueryItem(const QString &key) + \deprecated + + Removes the first query string pair whose key is equal to \a key + from the URL. + + \sa removeAllQueryItems() +*/ + +/*! + \fn void QUrl::removeEncodedQueryItem(const QByteArray &key) + \deprecated + \since 4.4 + + Removes the first query string pair whose key is equal to \a key + from the URL. + + Note: if the encoded \a key does not match the encoded version of + the query, this function will not work. That is, if the + encoded query of this URL is "search=Qt%20Rules", calling this + function with \a key = "%73earch" will do nothing. + + \sa removeQueryItem(), removeAllQueryItems() +*/ + +/*! + \fn void QUrl::removeAllQueryItems(const QString &key) + \deprecated + + Removes all the query string pairs whose key is equal to \a key + from the URL. + + \sa removeQueryItem() +*/ + +/*! + \fn void QUrl::removeAllEncodedQueryItems(const QByteArray &key) + \deprecated + \since 4.4 + + Removes all the query string pairs whose key is equal to \a key + from the URL. + + Note: if the encoded \a key does not match the encoded version of + the query, this function will not work. That is, if the + encoded query of this URL is "search=Qt%20Rules", calling this + function with \a key = "%73earch" will do nothing. + + \sa removeQueryItem() +*/ + +/*! + \fn QByteArray QUrl::encodedQuery() const + \deprecated + + Returns the query string of the URL in percent encoded form. +*/ + /*! Returns the query string of the URL if there's a query string, or an empty result if not. To determine if the parsed URL contained a query string, use @@ -2227,6 +2625,41 @@ QString QUrl::fragment(ComponentFormattingOptions options) const return result; } +/*! + \fn void QUrl::setEncodedFragment(const QByteArray &fragment) + \deprecated + \since 4.4 + + Sets the URL's fragment to the percent-encoded \a fragment. The fragment is the + last part of the URL, represented by a '#' followed by a string of + characters. It is typically used in HTTP for referring to a + certain link or point on a page: + + \image qurl-fragment.png + + The fragment is sometimes also referred to as the URL "reference". + + Passing an argument of QByteArray() (a null QByteArray) will unset + the fragment. Passing an argument of QByteArray("") (an empty but + not null QByteArray) will set the fragment to an empty string (as + if the original URL had a lone "#"). + + \sa setFragment(), encodedFragment() +*/ + +/*! + \fn QByteArray QUrl::encodedFragment() const + \deprecated + \since 4.4 + + Returns the fragment of the URL if it is defined; otherwise an + empty string is returned. The returned value will have its + non-ASCII and other control characters percent-encoded, as in + toEncoded(). + + \sa setEncodedFragment(), toEncoded() +*/ + /*! \since 4.2