// qdir.sip generated by MetaSIP on Sun Nov  9 16:48:00 2014
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2014 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 <qdir.h>
%End

class QDir
{
%TypeHeaderCode
#include <qdir.h>
%End

public:
    enum Filter
    {
        Dirs,
        Files,
        Drives,
        NoSymLinks,
        AllEntries,
        TypeMask,
        Readable,
        Writable,
        Executable,
        PermissionMask,
        Modified,
        Hidden,
        System,
        AccessMask,
        AllDirs,
        CaseSensitive,
        NoDotAndDotDot,
        NoFilter,
%If (Qt_4_7_0 -)
        NoDot,
%End
%If (Qt_4_7_0 -)
        NoDotDot,
%End
    };

    typedef QFlags<QDir::Filter> Filters;

    enum SortFlag
    {
        Name,
        Time,
        Size,
        Unsorted,
        SortByMask,
        DirsFirst,
        Reversed,
        IgnoreCase,
        DirsLast,
        LocaleAware,
        Type,
        NoSort,
    };

    typedef QFlags<QDir::SortFlag> SortFlags;
    QDir(const QDir &);
    QDir(const QString &path /DocValue="Py_v3:''"/ = QString());
    QDir(const QString &path, const QString &nameFilter, QFlags<QDir::SortFlag> sort /DocValue="QDir.Name|QDir.IgnoreCase"/ = QDir::SortFlags(QDir::Name|QDir::IgnoreCase), QFlags<QDir::Filter> filters = AllEntries);
    ~QDir();
    void setPath(const QString &path);
    QString path() const;
    QString absolutePath() const;
    QString canonicalPath() const;
    static void addResourceSearchPath(const QString &path);
    QString dirName() const;
    QString filePath(const QString &fileName) const;
    QString absoluteFilePath(const QString &fileName) const;
    QString relativeFilePath(const QString &fileName) const;
%If (- Qt_5_0_0)
    static QString convertSeparators(const QString &pathName);
%End
    bool cd(const QString &dirName);
    bool cdUp();
    QStringList nameFilters() const;
    void setNameFilters(const QStringList &nameFilters);
    QFlags<QDir::Filter> filter() const;
    void setFilter(QFlags<QDir::Filter> filter);
    QFlags<QDir::SortFlag> sorting() const;
    void setSorting(QFlags<QDir::SortFlag> sort);
    uint count() const /__len__/;
    QString operator[](int) const;
%MethodCode
        SIP_SSIZE_T idx = sipConvertFromSequenceIndex(a0, sipCpp->count());
        
        if (idx < 0)
            sipIsErr = 1;
        else
            sipRes = new QString(sipCpp->operator[]((int)idx));
%End

    QStringList operator[](SIP_PYSLICE) const;
%MethodCode
        SIP_SSIZE_T len, start, stop, step, slicelength, i;
        
        len = sipCpp->count();
        
        #if PY_VERSION_HEX >= 0x03020000
        if (PySlice_GetIndicesEx(a0, len, &start, &stop, &step, &slicelength) < 0)
        #else
        if (PySlice_GetIndicesEx((PySliceObject *)a0, len, &start, &stop, &step, &slicelength) < 0)
        #endif
            sipIsErr = 1;
        else
        {
            sipRes = new QStringList();
        
            for (i = 0; i < slicelength; ++i)
            {
                (*sipRes) += (*sipCpp)[start];
                start += step;
            }
        }
%End

    int __contains__(const QString &) const;
%MethodCode
        sipRes = bool(sipCpp->entryList().contains(*a0));
%End

    static QStringList nameFiltersFromString(const QString &nameFilter);
    QStringList entryList(QFlags<QDir::Filter> filters = NoFilter, QFlags<QDir::SortFlag> sort = NoSort) const;
    QStringList entryList(const QStringList &nameFilters, QFlags<QDir::Filter> filters = NoFilter, QFlags<QDir::SortFlag> sort = NoSort) const;
    QFileInfoList entryInfoList(QFlags<QDir::Filter> filters = NoFilter, QFlags<QDir::SortFlag> sort = NoSort) const;
    QFileInfoList entryInfoList(const QStringList &nameFilters, QFlags<QDir::Filter> filters = NoFilter, QFlags<QDir::SortFlag> sort = NoSort) const;
    bool mkdir(const QString &dirName) const;
    bool rmdir(const QString &dirName) const;
    bool mkpath(const QString &dirPath) const;
    bool rmpath(const QString &dirPath) const;
    bool isReadable() const;
    bool exists() const;
    bool isRoot() const;
    static bool isRelativePath(const QString &path);
    static bool isAbsolutePath(const QString &path);
    bool isRelative() const;
    bool isAbsolute() const;
    bool makeAbsolute();
    bool operator==(const QDir &dir) const;
    bool operator!=(const QDir &dir) const;
    bool remove(const QString &fileName);
    bool rename(const QString &oldName, const QString &newName);
    bool exists(const QString &name) const;
    void refresh() const;
    static QFileInfoList drives();
    static QChar separator();
    static bool setCurrent(const QString &path);
    static QDir current();
    static QString currentPath();
    static QDir home();
    static QString homePath();
    static QDir root();
    static QString rootPath();
    static QDir temp();
    static QString tempPath();
    static bool match(const QStringList &filters, const QString &fileName);
    static bool match(const QString &filter, const QString &fileName);
    static QString cleanPath(const QString &path);
%If (Qt_4_2_0 -)
    static QString toNativeSeparators(const QString &pathName);
%End
%If (Qt_4_2_0 -)
    static QString fromNativeSeparators(const QString &pathName);
%End
%If (Qt_4_3_0 -)
    static void setSearchPaths(const QString &prefix, const QStringList &searchPaths);
%End
%If (Qt_4_3_0 -)
    static void addSearchPath(const QString &prefix, const QString &path);
%End
%If (Qt_4_3_0 -)
    static QStringList searchPaths(const QString &prefix);
%End
%If (Qt_5_0_0 -)
    bool removeRecursively();
%End
%If (Qt_5_0_0 -)
    void swap(QDir &other);
%End
};

QFlags<QDir::Filter> operator|(QDir::Filter f1, QFlags<QDir::Filter> f2);
QFlags<QDir::SortFlag> operator|(QDir::SortFlag f1, QFlags<QDir::SortFlag> f2);
