com.trolltech.qt.core
Class QUrl

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QUrl
All Implemented Interfaces:
QtJambiInterface, java.lang.Comparable

public class QUrl
extends QtJambiObject
implements java.lang.Comparable

The QUrl class provides a convenient interface for working with URLs.

It can parse and construct URLs in both encoded and unencoded form. QUrl also has support for internationalized domain names (IDNs).

The most common way to use QUrl is to initialize it via the constructor by passing a QString. Otherwise, setUrl and setEncodedUrl can also be used.

URLs can be represented in two forms: encoded or unencoded. The unencoded representation is suitable for showing to users, but the encoded representation is typically what you would send to a web server. For example, the unencoded URL "http://bühler.example.com" would be sent to the server as "http://xn--bhler-kva.example.com/List%20of%20applicants.xml".

A URL can also be constructed piece by piece by calling setScheme, setUserName, setPassword, setHost, setPort, setPath, setEncodedQuery and setFragment. Some convenience functions are also available: setAuthority sets the user name, password, host and port. setUserInfo sets the user name and password at once.

Call isValid to check if the URL is valid. This can be done at any point during the constructing of a URL.

Constructing a query is particularly convenient through the use of setQueryItems, addQueryItem and removeQueryItem. Use setQueryDelimiters to customize the delimiters used for generating the query string.

For the convenience of generating encoded URL strings or query strings, there are two static functions called fromPercentEncoding and toPercentEncoding which deal with percent encoding and decoding of QStrings.

Calling isRelative will tell whether or not the URL is relative. A relative URL can be resolved by passing it as argument to resolved, which returns an absolute URL. isParentOf is used for determining whether one URL is a parent of another.

fromLocalFile constructs a QUrl by parsing a local file path. toLocalFile converts a URL to a local file path.

The human readable representation of the URL is fetched with toString. This representation is appropriate for displaying a URL to a user in unencoded form. The encoded form however, as returned by toEncoded, is for internal use, passing to web servers, mail clients and so on.

QUrl conforms to the URI specification from RFC 3986 (Uniform Resource Identifier: Generic Syntax), and includes scheme extensions from RFC 1738 (Uniform Resource Locators).

See Also:
QUrlInfo

Nested Class Summary
static class QUrl.FormattingOption
          The formatting options define how the URL is formatted when written out as text.
static class QUrl.FormattingOptions
          This QFlag class provides flags for the int enum.
static class QUrl.ParsingMode
          The parsing mode controls the way QUrl parses strings.
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Constructor Summary
QUrl()
          Constructs an empty QUrl object.
QUrl(QUrl copy)
          Constructs a copy of copy.
QUrl(java.lang.String url)
          Constructs a URL by parsing url.
QUrl(java.lang.String url, QUrl.ParsingMode mode)
          Parses the url using the parser mode mode.
 
Method Summary
 void addQueryItem(java.lang.String key, java.lang.String value)
          Inserts the pair key = value into the query string of the URL.
 java.util.List<java.lang.String> allQueryItemValues(java.lang.String key)
          Returns the a list of query string values whose key is equal to key from the URL.
 java.lang.String authority()
          Returns the authority of the URL if it is defined; otherwise an empty string is returned.
 void clear()
          Resets the content of the QUrl.
 int compareTo(java.lang.Object other)
           
 QByteArray encodedQuery()
          Returns the query string of the URL in percent encoded form.
 boolean equals(java.lang.Object other)
          
 java.lang.String errorString()
          Returns a text string that explains why an URL is invalid in the case being; otherwise returns an empty string.
 java.lang.String fragment()
          Returns the fragment of the URL.
static java.lang.String fromAce(QByteArray arg__1)
          Returns the Unicode form of the given domain name arg__1, which is encoded in the ASCII Compatible Encoding (ACE).
static QUrl fromEncoded(QByteArray url)
          Parses url and returns the corresponding QUrl.
static QUrl fromEncoded(QByteArray url, QUrl.ParsingMode mode)
          Parses the URL using mode.
static QUrl fromLocalFile(java.lang.String localfile)
          Returns a QUrl representation of localfile, interpreted as a local file.
static QUrl fromNativePointer(QNativePointer nativePointer)
          This function returns the QUrl instance pointed to by nativePointer
static java.lang.String fromPercentEncoding(QByteArray arg__1)
          Returns a decoded copy of arg__1.
 boolean hasFragment()
          Returns true if this URL contains a fragment (i.e., if # was seen on it).
 boolean hasQuery()
          Returns true if this URL contains a Query (i.e., if ? was seen on it).
 boolean hasQueryItem(java.lang.String key)
          Returns true if there is a query string pair whose key is equal to key from the URL.
 java.lang.String host()
          Returns the host of the URL if it is defined; otherwise an empty string is returned.
static java.util.List<java.lang.String> idnWhitelist()
          Returns the current whitelist of top-level domains that are allowed to have non-ASCII characters in their compositions.
 boolean isEmpty()
          Returns true if the URL has no data; otherwise returns false.
 boolean isParentOf(QUrl url)
          Returns true if this URL is a parent of url.
 boolean isRelative()
          Returns true if the URL is relative; otherwise returns false.
 boolean isValid()
          Returns true if the URL is valid; otherwise returns false.
static QNativePointer nativePointerArray(QUrl[] array)
          This function returns a QNativePointer that is pointing to the specified QUrl array.
 java.lang.String password()
          Returns the password of the URL if it is defined; otherwise an empty string is returned.
 java.lang.String path()
          Returns the path of the URL.
 int port()
          Returns the port of the URL, or -1 if the port is unspecified.
 int port(int defaultPort)
          Returns the port of the URL, or defaultPort if the port is unspecified.
 java.util.List<QPair<java.lang.String,java.lang.String>> queryItems()
          Returns the query string of the URL, as a map of keys and values.
 java.lang.String queryItemValue(java.lang.String key)
          Returns the first query string value whose key is equal to key from the URL.
 byte queryPairDelimiter()
          Returns the character used to delimit between key-value pairs in the query string of the URL.
 byte queryValueDelimiter()
          Returns the character used to delimit between keys and values in the query string of the URL.
 void readFrom(QDataStream arg__1)
          Reads a QUrl from arg__1.
 void removeAllQueryItems(java.lang.String key)
          Removes all the query string pairs whose key is equal to key from the URL.
 void removeQueryItem(java.lang.String key)
          Removes the first query string pair whose key is equal to key from the URL.
 QUrl resolved(QUrl relative)
          Returns the result of the merge of this URL with relative.
 java.lang.String scheme()
          Returns the scheme of the URL.
 void setAuthority(java.lang.String authority)
          Sets the authority of the URL to authority.
 void setEncodedQuery(QByteArray query)
          Sets the query string of the URL to query.
 void setEncodedUrl(QByteArray url)
          Constructs a URL by parsing the contents of url.
 void setEncodedUrl(QByteArray url, QUrl.ParsingMode mode)
          Constructs a URL by parsing the contents of url using the given mode.
 void setFragment(java.lang.String fragment)
          Sets the fragment of the URL to fragment.
 void setHost(java.lang.String host)
          Sets the host of the URL to host.
static void setIdnWhitelist(java.util.List<java.lang.String> arg__1)
          Sets the whitelist of Top-Level Domains (TLDs) that are allowed to have non-ASCII characters in domains to the value of arg__1.
 void setPassword(java.lang.String password)
          Sets the URL's password to password.
 void setPath(java.lang.String path)
          Sets the path of the URL to path.
 void setPort(int port)
          Sets the port of the URL to port.
 void setQueryDelimiters(byte valueDelimiter, byte pairDelimiter)
          Sets the characters used for delimiting between keys and values, and between key-value pairs in the URL's query string.
 void setQueryItems(java.util.List<QPair<java.lang.String,java.lang.String>> query)
          Sets the query string of the URL to an encoded version of query.
 void setScheme(java.lang.String scheme)
          Sets the scheme of the URL to scheme.
 void setUrl(java.lang.String url)
          Constructs a URL by parsing the contents of url.
 void setUrl(java.lang.String url, QUrl.ParsingMode mode)
          Parses url using the parsing mode mode.
 void setUserInfo(java.lang.String userInfo)
          Sets the user info of the URL to userInfo.
 void setUserName(java.lang.String userName)
          Sets the URL's user name to userName.
static QByteArray toAce(java.lang.String arg__1)
          Returns the ASCII Compatible Encoding of the given domain name arg__1.
 QByteArray toEncoded()
          Equivalent to toEncoded(None).
 QByteArray toEncoded(QUrl.FormattingOption... options)
          Returns the encoded representation of the URL if it's valid; otherwise an empty QByteArray is returned.
 QByteArray toEncoded(QUrl.FormattingOptions options)
          Returns the encoded representation of the URL if it's valid; otherwise an empty QByteArray is returned.
 java.lang.String toLocalFile()
          Returns the path of this URL formatted as a local file path.
static QByteArray toPercentEncoding(java.lang.String arg__1)
          Equivalent to toPercentEncoding(arg__1, QByteArray(), QByteArray()).
static QByteArray toPercentEncoding(java.lang.String arg__1, QByteArray exclude)
          Equivalent to toPercentEncoding(arg__1, exclude, QByteArray()).
static QByteArray toPercentEncoding(java.lang.String arg__1, QByteArray exclude, QByteArray include)
          Returns an encoded copy of arg__1.
 java.lang.String toString()
          Equivalent to toString(None).
 java.lang.String toString(QUrl.FormattingOption... options)
          Returns the human-displayable string representation of the URL.
 java.lang.String toString(QUrl.FormattingOptions options)
          Returns the human-displayable string representation of the URL.
 java.lang.String userInfo()
          Returns the user info of the URL, or an empty string if the user info is undefined.
 java.lang.String userName()
          Returns the user name of the URL if it is defined; otherwise an empty string is returned.
 void writeTo(QDataStream arg__1)
          Writes thisQUrl to arg__1.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QUrl

public QUrl(QUrl copy)

Constructs a copy of copy.


QUrl

public QUrl(java.lang.String url)

Constructs a URL by parsing url. url is assumed to be in human readable representation, with no percent encoding. QUrl will automatically percent encode all characters that are not allowed in a URL.

Example:

    QUrl url("http://www.example.com/List of holidays.xml");
    // url.toEncoded() == "http://www.example.com/List%20of%20holidays.xml"

To construct a URL from an encoded string, call fromEncoded:

    QUrl url = QUrl::fromEncoded("http://www.trolltech.com/List%20of%20holidays.xml");

See Also:
setUrl, setEncodedUrl, fromEncoded, TolerantMode

QUrl

public QUrl(java.lang.String url,
            QUrl.ParsingMode mode)

Parses the url using the parser mode mode.

See Also:
setUrl

QUrl

public QUrl()

Constructs an empty QUrl object.

Method Detail

addQueryItem

public final void addQueryItem(java.lang.String key,
                               java.lang.String value)

Inserts the pair key = value into the query string of the URL.


allQueryItemValues

public final java.util.List<java.lang.String> allQueryItemValues(java.lang.String key)

Returns the a list of query string values whose key is equal to key from the URL.

See Also:
queryItemValue

authority

public final java.lang.String authority()

Returns the authority of the URL if it is defined; otherwise an empty string is returned.

See Also:
setAuthority

clear

public final void clear()

Resets the content of the QUrl. After calling this function, the QUrl is equal to one that has been constructed with the default empty constructor.


encodedQuery

public final QByteArray encodedQuery()

Returns the query string of the URL in percent encoded form.

See Also:
setEncodedQuery

errorString

public final java.lang.String errorString()

Returns a text string that explains why an URL is invalid in the case being; otherwise returns an empty string.


fragment

public final java.lang.String fragment()

Returns the fragment of the URL.

See Also:
setFragment

hasFragment

public final boolean hasFragment()

Returns true if this URL contains a fragment (i.e., if # was seen on it).

See Also:
fragment, setFragment

hasQuery

public final boolean hasQuery()

Returns true if this URL contains a Query (i.e., if ? was seen on it).

See Also:
hasQueryItem, encodedQuery

hasQueryItem

public final boolean hasQueryItem(java.lang.String key)

Returns true if there is a query string pair whose key is equal to key from the URL.


host

public final java.lang.String host()

Returns the host of the URL if it is defined; otherwise an empty string is returned.

See Also:
setHost

isEmpty

public final boolean isEmpty()

Returns true if the URL has no data; otherwise returns false.


isParentOf

public final boolean isParentOf(QUrl url)

Returns true if this URL is a parent of url. url is a child of this URL if the two URLs share the same scheme and authority, and this URL's path is a parent of the path of url.


isRelative

public final boolean isRelative()

Returns true if the URL is relative; otherwise returns false. A URL is relative if its scheme is undefined; this function is therefore equivalent to calling scheme.isEmpty.


isValid

public final boolean isValid()

Returns true if the URL is valid; otherwise returns false.

The URL is run through a conformance test. Every part of the URL must conform to the standard encoding rules of the URI standard for the URL to be reported as valid.

    bool checkUrl(const QUrl &url) {
        if (!url.isValid()) {
            qDebug(QString("Invalid URL: %1").arg(url.toString()));
            return false;
        }

        return true;
    }


writeTo

public final void writeTo(QDataStream arg__1)
Writes thisQUrl to arg__1.


readFrom

public final void readFrom(QDataStream arg__1)
Reads a QUrl from arg__1.


password

public final java.lang.String password()

Returns the password of the URL if it is defined; otherwise an empty string is returned.

See Also:
setPassword, setUserName

path

public final java.lang.String path()

Returns the path of the URL.

See Also:
setPath

port

public final int port()

Returns the port of the URL, or -1 if the port is unspecified.


port

public final int port(int defaultPort)

Returns the port of the URL, or defaultPort if the port is unspecified.

Example:

    QFtp ftp;
    ftp.connectToHost(url.host(), url.port(21));

See Also:
setPort

queryItemValue

public final java.lang.String queryItemValue(java.lang.String key)

Returns the first query string value whose key is equal to key from the URL.

See Also:
allQueryItemValues

queryItems

public final java.util.List<QPair<java.lang.String,java.lang.String>> queryItems()

Returns the query string of the URL, as a map of keys and values.

See Also:
setQueryItems, setEncodedQuery

queryPairDelimiter

public final byte queryPairDelimiter()

Returns the character used to delimit between key-value pairs in the query string of the URL.


queryValueDelimiter

public final byte queryValueDelimiter()

Returns the character used to delimit between keys and values in the query string of the URL.


removeAllQueryItems

public final void removeAllQueryItems(java.lang.String key)

Removes all the query string pairs whose key is equal to key from the URL.

See Also:
removeQueryItem

removeQueryItem

public final void removeQueryItem(java.lang.String key)

Removes the first query string pair whose key is equal to key from the URL.

See Also:
removeAllQueryItems

resolved

public final QUrl resolved(QUrl relative)

Returns the result of the merge of this URL with relative. This URL is used as a base to convert relative to an absolute URL.

If relative is not a relative URL, this function will return relative directly. Otherwise, the paths of the two URLs are merged, and the new URL returned has the scheme and authority of the base URL, but with the merged path, as in the following example:

    QUrl baseUrl("http://www.trolltech.com/support");
    QUrl relativeUrl("../products/solutions");
    qDebug(baseUrl.resolved(relativeUrl).toString());
    // prints "http://www.trolltech.com/products/solutions"

Calling resolved with ".." returns a QUrl whose directory is one level higher than the original. Similarly, calling resolved with "../.." removes two levels from the path. If relative is "/", the path becomes "/".

See Also:
isRelative

scheme

public final java.lang.String scheme()

Returns the scheme of the URL. If an empty string is returned, this means the scheme is undefined and the URL is then relative.

See Also:
setScheme, isRelative

setAuthority

public final void setAuthority(java.lang.String authority)

Sets the authority of the URL to authority.

The authority of a URL is the combination of user info, a host name and a port. All of these elements are optional; an empty authority is therefore valid.

The user info and host are separated by a '@', and the host and port are separated by a ':'. If the user info is empty, the '@' must be omitted; although a stray ':' is permitted if the port is empty.

The following example shows a valid authority string:

See Also:
authority

setEncodedQuery

public final void setEncodedQuery(QByteArray query)

Sets the query string of the URL to 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 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 "?".

See Also:
encodedQuery, hasQuery

setEncodedUrl

public final void setEncodedUrl(QByteArray url,
                                QUrl.ParsingMode mode)

Constructs a URL by parsing the contents of url using the given mode.


setEncodedUrl

public final void setEncodedUrl(QByteArray url)

Constructs a URL by parsing the contents of url.

url 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.

See Also:
setUrl

setFragment

public final void setFragment(java.lang.String fragment)

Sets the fragment of the URL to 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:

The fragment is sometimes also referred to as the URL "reference".

Passing an argument of QString (a null QString) will unset the fragment. Passing an argument of QString("") (an empty but not null QString) will set the fragment to an empty string (as if the original URL had a lone "#").

See Also:
fragment, hasFragment

setHost

public final void setHost(java.lang.String host)

Sets the host of the URL to host. The host is part of the authority.

See Also:
host, setAuthority

setPassword

public final void setPassword(java.lang.String password)

Sets the URL's password to password. The password is part of the user info element in the authority of the URL, as described in setUserInfo.

See Also:
password, setUserInfo

setPath

public final void setPath(java.lang.String path)

Sets the path of the URL to path. The path is the part of the URL that comes after the authority but before the query string.

For non-hierarchical schemes, the path will be everything following the scheme declaration, as in the following example:

See Also:
path

setPort

public final void setPort(int port)

Sets the port of the URL to port. The port is part of the authority of the URL, as described in setAuthority.

port must be between 0 and 65535 inclusive. Setting the port to -1 indicates that the port is unspecified.

See Also:
port

setQueryDelimiters

public final void setQueryDelimiters(byte valueDelimiter,
                                     byte pairDelimiter)

Sets the characters used for delimiting between keys and values, and between key-value pairs in the URL's query string. The default value delimiter is '=' and the default pair delimiter is '&'.

valueDelimiter will be used for separating keys from values, and pairDelimiter will be used to separate key-value pairs. Any occurrences of these delimiting characters in the encoded representation of the keys and values of the query string are percent encoded.

If valueDelimiter is set to '-' and pairDelimiter is '/', the above query string would instead be represented like this:

    http://www.example.com/cgi-bin/drawgraph.cgi?type-pie/color-green

Calling this function does not change the delimiters of the current query string. It only affects queryItems, setQueryItems and addQueryItems().


setQueryItems

public final void setQueryItems(java.util.List<QPair<java.lang.String,java.lang.String>> query)
Sets the query string of the URL to an encoded version of query. The contents of 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().


setScheme

public final void setScheme(java.lang.String scheme)

Sets the scheme of the URL to scheme. As a scheme can only contain ASCII characters, no conversion or encoding is done on the input.

The scheme describes the type (or protocol) of the URL. It's represented by one or more ASCII characters at the start the URL, and is followed by a ':'. The following example shows a URL where the scheme is "ftp":

The scheme can also be empty, in which case the URL is interpreted as relative.

See Also:
scheme, isRelative

setUrl

public final void setUrl(java.lang.String url)

Constructs a URL by parsing the contents of url.

url is assumed to be in unicode format, with no percent encoding.

Calling isValid will tell whether or not a valid URL was constructed.

See Also:
setEncodedUrl

setUrl

public final void setUrl(java.lang.String url,
                         QUrl.ParsingMode mode)

Parses url using the parsing mode mode.

See Also:
setEncodedUrl

setUserInfo

public final void setUserInfo(java.lang.String userInfo)

Sets the user info of the URL to userInfo. The user info is an optional part of the authority of the URL, as described in setAuthority.

The user info consists of a user name and optionally a password, separated by a ':'. If the password is empty, the colon must be omitted. The following example shows a valid user info string:

See Also:
userInfo, setUserName, setPassword, setAuthority

setUserName

public final void setUserName(java.lang.String userName)

Sets the URL's user name to userName. The userName is part of the user info element in the authority of the URL, as described in setUserInfo.

See Also:
userName, setUserInfo

toEncoded

public final QByteArray toEncoded(QUrl.FormattingOption... options)

Returns the encoded representation of the URL if it's valid; otherwise an empty QByteArray is returned. The output can be customized by passing flags with options.

The user info, path and fragment are all converted to UTF-8, and all non-ASCII characters are then percent encoded. The host name is encoded using Punycode.


toEncoded

public final QByteArray toEncoded()

Equivalent to toEncoded(None).


toEncoded

public final QByteArray toEncoded(QUrl.FormattingOptions options)

Returns the encoded representation of the URL if it's valid; otherwise an empty QByteArray is returned. The output can be customized by passing flags with options.

The user info, path and fragment are all converted to UTF-8, and all non-ASCII characters are then percent encoded. The host name is encoded using Punycode.


toLocalFile

public final java.lang.String toLocalFile()

Returns the path of this URL formatted as a local file path.

See Also:
fromLocalFile

toString

public final java.lang.String toString(QUrl.FormattingOption... options)

Returns the human-displayable string representation of the URL. The output can be customized by passing flags with options.

See Also:
FormattingOptions, toEncoded

toString

public final java.lang.String toString()

Equivalent to toString(None).

Overrides:
toString in class java.lang.Object

toString

public final java.lang.String toString(QUrl.FormattingOptions options)

Returns the human-displayable string representation of the URL. The output can be customized by passing flags with options.

See Also:
FormattingOptions, toEncoded

userInfo

public final java.lang.String userInfo()

Returns the user info of the URL, or an empty string if the user info is undefined.

See Also:
setUserInfo

userName

public final java.lang.String userName()

Returns the user name of the URL if it is defined; otherwise an empty string is returned.

See Also:
setUserName

fromAce

public static java.lang.String fromAce(QByteArray arg__1)

Returns the Unicode form of the given domain name arg__1, which is encoded in the ASCII Compatible Encoding (ACE). The result of this function is considered equivalent to arg__1.

If the value in arg__1 cannot be encoded, it will be converted to QString and returned.

The ASCII Compatible Encoding (ACE) is defined by RFC 3490, RFC 3491 and RFC 3492. It is part of the Internationalizing Domain Names in Applications (IDNA) specification, which allows for domain names (like "www.trolltech.com") to be written using international characters.


fromEncoded

public static QUrl fromEncoded(QByteArray url)

Parses url and returns the corresponding QUrl. url is assumed to be in encoded form, containing only ASCII characters.

The URL is parsed using TolerantMode.

See Also:
toEncoded, setUrl

fromEncoded

public static QUrl fromEncoded(QByteArray url,
                               QUrl.ParsingMode mode)

Parses the URL using mode.

See Also:
toEncoded, setUrl

fromLocalFile

public static QUrl fromLocalFile(java.lang.String localfile)

Returns a QUrl representation of localfile, interpreted as a local file.

See Also:
toLocalFile

fromPercentEncoding

public static java.lang.String fromPercentEncoding(QByteArray arg__1)

Returns a decoded copy of arg__1. arg__1 is first decoded from percent encoding, then converted from UTF-8 to unicode.


idnWhitelist

public static java.util.List<java.lang.String> idnWhitelist()

Returns the current whitelist of top-level domains that are allowed to have non-ASCII characters in their compositions.

See setIdnWhitelist for the rationale of this list.

See Also:
setIdnWhitelist

setIdnWhitelist

public static void setIdnWhitelist(java.util.List<java.lang.String> arg__1)

Sets the whitelist of Top-Level Domains (TLDs) that are allowed to have non-ASCII characters in domains to the value of arg__1.

Qt has comes a default list that contains the Internet top-level domains that have published support for Internationalized Domain Names (IDNs) and rules to guarantee that no deception can happen between similarly-looking characters (such as the Latin lowercase letter 'a' and the Cyrillic equivalent, which in most fonts are visually identical).

This list is periodically maintained, as registrars publish new rules.

This function is provided for those who need to manipulate the list, in order to add or remove a TLD. It is not recommended to change its value for purposes other than testing, as it may expose users to security risks.

See Also:
idnWhitelist

toAce

public static QByteArray toAce(java.lang.String arg__1)

Returns the ASCII Compatible Encoding of the given domain name arg__1. The result of this function is considered equivalent to arg__1.

The ASCII-Compatible Encoding (ACE) is defined by RFC 3490, RFC 3491 and RFC 3492. It is part of the Internationalizing Domain Names in Applications (IDNA) specification, which allows for domain names (like "www.trolltech.com") to be written using international characters.


toPercentEncoding

public static QByteArray toPercentEncoding(java.lang.String arg__1,
                                           QByteArray exclude)

Equivalent to toPercentEncoding(arg__1, exclude, QByteArray()).


toPercentEncoding

public static QByteArray toPercentEncoding(java.lang.String arg__1)

Equivalent to toPercentEncoding(arg__1, QByteArray(), QByteArray()).


toPercentEncoding

public static QByteArray toPercentEncoding(java.lang.String arg__1,
                                           QByteArray exclude,
                                           QByteArray include)

Returns an encoded copy of arg__1. arg__1 is first converted to UTF-8, and all ASCII-characters that are not in the unreserved group are percent encoded. To prevent characters from being percent encoded pass them to exclude. To force characters to be percent encoded pass them to include.

Unreserved is defined as: ALPHA / DIGIT / "-" / "." / "_" / "~"

    QByteArray ba = QUrl::toPercentEncoding("{a fishy string?}", "{}", "s");
    qDebug(ba.constData());
    // prints "{a fi%73hy %73tring%3F}"


fromNativePointer

public static QUrl fromNativePointer(QNativePointer nativePointer)
This function returns the QUrl instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

nativePointerArray

public static QNativePointer nativePointerArray(QUrl[] array)
This function returns a QNativePointer that is pointing to the specified QUrl array.

Parameters:
array - the array that the returned pointer will point to.
Returns:
a QNativePointer that is pointing to the specified array.

equals

public boolean equals(java.lang.Object other)

Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object other)
Specified by:
compareTo in interface java.lang.Comparable