// qurl.sip generated by MetaSIP on Fri Feb 10 10:35:12 2012
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2011 Riverbank Computing Limited <info@riverbankcomputing.com>
// 
// This file is part of PyQt.
// 
// This file may be used under the terms of the GNU General Public
// License versions 2.0 or 3.0 as published by the Free Software
// Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
// included in the packaging of this file.  Alternatively you may (at
// your option) use any later version of the GNU General Public
// License if such license has been publicly approved by Riverbank
// Computing Limited (or its successors, if any) and the KDE Free Qt
// Foundation. In addition, as a special exception, Riverbank gives you
// certain additional rights. These rights are described in the Riverbank
// GPL Exception version 1.1, which can be found in the file
// GPL_EXCEPTION.txt in this package.
// 
// If you are unsure which license is appropriate for your use, please
// contact the sales department at sales@riverbankcomputing.com.
// 
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.


%ModuleCode
#include <qurl.h>
%End

class QUrl
{
%TypeHeaderCode
#include <qurl.h>
%End

%TypeCode
#include <QHash>
%End

public:
    QUrl();
    QUrl(const QString &url);
    QUrl(const QUrl &copy);
    QUrl(const QString &url, QUrl::ParsingMode mode);
    ~QUrl();
    SIP_PYOBJECT __repr__() const /DocType="str"/;
%MethodCode
        PyObject *uni = qpycore_PyObject_FromQString(sipCpp->toString());
        
        if (uni)
        {
        #if PY_MAJOR_VERSION >= 3
            sipRes = PyUnicode_FromFormat("PyQt4.QtCore.QUrl(%R)", uni);
        #else
            sipRes = PyString_FromFormat("PyQt4.QtCore.QUrl(");
            PyString_ConcatAndDel(&sipRes, PyObject_Repr(uni));
            PyString_ConcatAndDel(&sipRes, PyString_FromString(")"));
        #endif
        
            Py_DECREF(uni);
        }
%End

    long __hash__() const;
%MethodCode
        if (sipIsAPIEnabled("QUrl", 2, 0))
        {
        #if QT_VERSION >= 0x040700
            sipRes = qHash(*sipCpp);
        #else
            sipRes = qHash(sipCpp->toString());
        #endif
        }
        else
        {
            // Mimic Python's default behavour.
            sipRes = _Py_HashPointer(sipSelf);
        }
%End

    enum FormattingOption
    {
        None,
        RemoveScheme,
        RemovePassword,
        RemoveUserInfo,
        RemovePort,
        RemoveAuthority,
        RemovePath,
        RemoveQuery,
        RemoveFragment,
        StripTrailingSlash,
    };

    typedef QFlags<QUrl::FormattingOption> FormattingOptions;

    enum ParsingMode
    {
        TolerantMode,
        StrictMode,
    };

    void setUrl(const QString &url);
    void setUrl(const QString &url, QUrl::ParsingMode mode);
    void setEncodedUrl(const QByteArray &url);
    void setEncodedUrl(const QByteArray &url, QUrl::ParsingMode mode);
    bool isValid() const;
    bool isEmpty() const;
    void clear();
    void setScheme(const QString &scheme);
    QString scheme() const;
    void setAuthority(const QString &authority);
    QString authority() const;
    void setUserInfo(const QString &userInfo);
    QString userInfo() const;
    void setUserName(const QString &userName);
    QString userName() const;
    void setPassword(const QString &password);
    QString password() const;
    void setHost(const QString &host);
    QString host() const;
    void setPort(int port);
    int port() const;
    int port(int defaultPort) const;
    void setPath(const QString &path);
    QString path() const;
    void setEncodedQuery(const QByteArray &query);
    QByteArray encodedQuery() const;
    void setQueryDelimiters(char valueDelimiter, char pairDelimiter);
    char queryValueDelimiter() const;
    char queryPairDelimiter() const;
    void setQueryItems(const QList<QPair<QString, QString>> &query);
    void addQueryItem(const QString &key, const QString &value);
    QList<QPair<QString, QString>> queryItems() const;
    bool hasQueryItem(const QString &key) const;
    QString queryItemValue(const QString &key) const;
    QStringList allQueryItemValues(const QString &key) const;
    void removeQueryItem(const QString &key);
    void removeAllQueryItems(const QString &key);
    void setFragment(const QString &fragment);
    QString fragment() const;
    QUrl resolved(const QUrl &relative) const;
    bool isRelative() const;
    bool isParentOf(const QUrl &url) const;
    static QUrl fromLocalFile(const QString &localfile);
    QString toLocalFile() const;
    QString toString(QFlags<QUrl::FormattingOption> options = None) const;
    QByteArray toEncoded(QFlags<QUrl::FormattingOption> options = None) const;
    static QUrl fromEncoded(const QByteArray &url);
    static QUrl fromEncoded(const QByteArray &url, QUrl::ParsingMode mode);
    void detach();
    bool isDetached() const;
    bool operator<(const QUrl &url) const;
    bool operator==(const QUrl &url) const;
    bool operator!=(const QUrl &url) const;
    static QString fromPercentEncoding(const QByteArray &);
    static QByteArray toPercentEncoding(const QString &input, const QByteArray &exclude = QByteArray(), const QByteArray &include = QByteArray());
    static QString fromPunycode(const QByteArray &);
    static QByteArray toPunycode(const QString &);
%If (Qt_4_2_0 -)
    bool hasQuery() const;
%End
%If (Qt_4_2_0 -)
    bool hasFragment() const;
%End
%If (Qt_4_2_0 -)
    QString errorString() const;
%End
%If (Qt_4_2_0 -)
    static QString fromAce(const QByteArray &);
%End
%If (Qt_4_2_0 -)
    static QByteArray toAce(const QString &);
%End
%If (Qt_4_2_0 -)
    static QStringList idnWhitelist();
%End
%If (Qt_4_2_0 -)
    static void setIdnWhitelist(const QStringList &);
%End
%If (Qt_4_4_0 -)
    void setEncodedUserName(const QByteArray &userName);
%End
%If (Qt_4_4_0 -)
    QByteArray encodedUserName() const;
%End
%If (Qt_4_4_0 -)
    void setEncodedPassword(const QByteArray &password);
%End
%If (Qt_4_4_0 -)
    QByteArray encodedPassword() const;
%End
%If (Qt_4_4_0 -)
    void setEncodedHost(const QByteArray &host);
%End
%If (Qt_4_4_0 -)
    QByteArray encodedHost() const;
%End
%If (Qt_4_4_0 -)
    void setEncodedPath(const QByteArray &path);
%End
%If (Qt_4_4_0 -)
    QByteArray encodedPath() const;
%End
%If (Qt_4_4_0 -)
    void setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray>> &query);
%End
%If (Qt_4_4_0 -)
    void addEncodedQueryItem(const QByteArray &key, const QByteArray &value);
%End
%If (Qt_4_4_0 -)
    QList<QPair<QByteArray, QByteArray>> encodedQueryItems() const;
%End
%If (Qt_4_4_0 -)
    bool hasEncodedQueryItem(const QByteArray &key) const;
%End
%If (Qt_4_4_0 -)
    QByteArray encodedQueryItemValue(const QByteArray &key) const;
%End
%If (Qt_4_4_0 -)
    QList<QByteArray> allEncodedQueryItemValues(const QByteArray &key) const;
%End
%If (Qt_4_4_0 -)
    void removeEncodedQueryItem(const QByteArray &key);
%End
%If (Qt_4_4_0 -)
    void removeAllEncodedQueryItems(const QByteArray &key);
%End
%If (Qt_4_4_0 -)
    void setEncodedFragment(const QByteArray &fragment);
%End
%If (Qt_4_4_0 -)
    QByteArray encodedFragment() const;
%End
%If (Qt_4_6_0 -)
    static QUrl fromUserInput(const QString &userInput);
%End
%If (Qt_4_8_0 -)
    void swap(QUrl &other);
%End
%If (Qt_4_8_0 -)
    QString topLevelDomain() const;
%End
%If (Qt_4_8_0 -)
    bool isLocalFile() const;
%End
};

QFlags<QUrl::FormattingOption> operator|(QUrl::FormattingOption f1, QFlags<QUrl::FormattingOption> f2);
QDataStream &operator<<(QDataStream &, const QUrl & /Constrained/);
QDataStream &operator>>(QDataStream &, QUrl & /Constrained/);
%If (Qt_4_3_0 -)
void qSwap(QUrl &value1, QUrl &value2);
%End
