// qurl.sip generated by MetaSIP on Fri Apr 16 11:32:08 2010
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2010 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.
// 
// Please review the following information to ensure GNU General
// Public Licensing requirements will be met:
// http://trolltech.com/products/qt/licenses/licensing/opensource/. If
// you are unsure which license is appropriate for your use, please
// review the following information:
// http://trolltech.com/products/qt/licenses/licensing/licensingoverview
// or 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 &);
    QUrl(const QUrl &);
    QUrl(const QString &, QUrl::ParsingMode);
    ~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))
        {
            sipRes = qHash(sipCpp->toString());
        }
        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 &);
    void setUrl(const QString &, QUrl::ParsingMode);
    void setEncodedUrl(const QByteArray &);
    void setEncodedUrl(const QByteArray &, QUrl::ParsingMode);
    bool isValid() const;
    bool isEmpty() const;
    void clear();
    void setScheme(const QString &);
    QString scheme() const;
    void setAuthority(const QString &);
    QString authority() const;
    void setUserInfo(const QString &);
    QString userInfo() const;
    void setUserName(const QString &);
    QString userName() const;
    void setPassword(const QString &);
    QString password() const;
    void setHost(const QString &);
    QString host() const;
    void setPort(int);
    int port() const;
    int port(int) const;
    void setPath(const QString &);
    QString path() const;
    void setEncodedQuery(const QByteArray &);
    QByteArray encodedQuery() const;
    void setQueryDelimiters(char, char);
    char queryValueDelimiter() const;
    char queryPairDelimiter() const;
    void setQueryItems(const QList<QPair<QString, QString> > &);
    void addQueryItem(const QString &, const QString &);
    QList<QPair<QString, QString> > queryItems() const;
    bool hasQueryItem(const QString &) const;
    QString queryItemValue(const QString &) const;
    QStringList allQueryItemValues(const QString &) const;
    void removeQueryItem(const QString &);
    void removeAllQueryItems(const QString &);
    void setFragment(const QString &);
    QString fragment() const;
    QUrl resolved(const QUrl &) const;
    bool isRelative() const;
    bool isParentOf(const QUrl &) const;
    static QUrl fromLocalFile(const QString &);
    QString toLocalFile() const;
    QString toString(QFlags<QUrl::FormattingOption> options = None) const;
    QByteArray toEncoded(QFlags<QUrl::FormattingOption> options = None) const;
    static QUrl fromEncoded(const QByteArray &);
    static QUrl fromEncoded(const QByteArray &, QUrl::ParsingMode);
    void detach();
    bool isDetached() const;
    bool operator<(const QUrl &) const;
    bool operator==(const QUrl &) const;
    bool operator!=(const QUrl &) const;
    static QString fromPercentEncoding(const QByteArray &);
    static QByteArray toPercentEncoding(const QString &, 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 &);
%End
%If (Qt_4_4_0 -)
    QByteArray encodedUserName() const;
%End
%If (Qt_4_4_0 -)
    void setEncodedPassword(const QByteArray &);
%End
%If (Qt_4_4_0 -)
    QByteArray encodedPassword() const;
%End
%If (Qt_4_4_0 -)
    void setEncodedHost(const QByteArray &);
%End
%If (Qt_4_4_0 -)
    QByteArray encodedHost() const;
%End
%If (Qt_4_4_0 -)
    void setEncodedPath(const QByteArray &);
%End
%If (Qt_4_4_0 -)
    QByteArray encodedPath() const;
%End
%If (Qt_4_4_0 -)
    void setEncodedQueryItems(const QList<QPair<QByteArray, QByteArray> > &);
%End
%If (Qt_4_4_0 -)
    void addEncodedQueryItem(const QByteArray &, const QByteArray &);
%End
%If (Qt_4_4_0 -)
    QList<QPair<QByteArray, QByteArray> > encodedQueryItems() const;
%End
%If (Qt_4_4_0 -)
    bool hasEncodedQueryItem(const QByteArray &) const;
%End
%If (Qt_4_4_0 -)
    QByteArray encodedQueryItemValue(const QByteArray &) const;
%End
%If (Qt_4_4_0 -)
    QList<QByteArray> allEncodedQueryItemValues(const QByteArray &) const;
%End
%If (Qt_4_4_0 -)
    void removeEncodedQueryItem(const QByteArray &);
%End
%If (Qt_4_4_0 -)
    void removeAllEncodedQueryItems(const QByteArray &);
%End
%If (Qt_4_4_0 -)
    void setEncodedFragment(const QByteArray &);
%End
%If (Qt_4_4_0 -)
    QByteArray encodedFragment() const;
%End
%If (Qt_4_6_0 -)
    static QUrl fromUserInput(const QString &);
%End
};

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