// qdir.sip generated by MetaSIP
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2025 Riverbank Computing Limited <info@riverbankcomputing.com>
// 
// This file is part of PyQt6.
// 
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file.  Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
// 
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license.  For more information contact
// info@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.


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

public:
    enum Filter /BaseType=Flag/
    {
        Dirs,
        Files,
        Drives,
        NoSymLinks,
        AllEntries,
        TypeMask,
        Readable,
        Writable,
        Executable,
        PermissionMask,
        Modified,
        Hidden,
        System,
        AccessMask,
        AllDirs,
        CaseSensitive,
        NoDotAndDotDot,
        NoFilter,
        NoDot,
        NoDotDot,
    };

    typedef QFlags<QDir::Filter> Filters;

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

    typedef QFlags<QDir::SortFlag> SortFlags;
    QDir(const QString &path, const QString &nameFilter, QDir::SortFlags sort = QDir::SortFlags(QDir::Name | QDir::IgnoreCase), QDir::Filters filters = QDir::AllEntries);
    QDir(const QDir &);
    QDir(const QString &path = QString());
    ~QDir();
    void setPath(const QString &path);
    QString path() const;
    QString absolutePath() const;
    QString canonicalPath() const;
    QString dirName() const;
    QString filePath(const QString &fileName) const;
    QString absoluteFilePath(const QString &fileName) const;
    QString relativeFilePath(const QString &fileName) const;
    bool cd(const QString &dirName);
    bool cdUp();
    QStringList nameFilters() const;
    void setNameFilters(const QStringList &nameFilters);
    QDir::Filters filter() const;
    void setFilter(QDir::Filters filter);
    QDir::SortFlags sorting() const;
    void setSorting(QDir::SortFlags sort);
%If (Qt_6_5_0 -)
    qsizetype count() const /__len__/;
%MethodCode
        sipRes = sipCpp->count(Qt::Disambiguated);
%End

%End
%If (- Qt_6_5_0)
    uint count() const /__len__/;
%End
%If (Qt_6_5_0 -)
    QString operator[](qsizetype) const;
%MethodCode
        Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count());
        
        if (idx < 0)
            sipIsErr = 1;
        else
            sipRes = new QString(sipCpp->operator[]((qsizetype)idx));
%End

%End
%If (- Qt_6_5_0)
    QString operator[](int) const;
%MethodCode
        Py_ssize_t idx = sipConvertFromSequenceIndex(a0, sipCpp->count());
        
        if (idx < 0)
            sipIsErr = 1;
        else
            sipRes = new QString(sipCpp->operator[]((int)idx));
%End

%End
    QStringList operator[](SIP_PYSLICE) const;
%MethodCode
        Py_ssize_t start, stop, step, slicelength;
        
        if (sipConvertFromSliceObject(a0, sipCpp->count(), &start, &stop, &step, &slicelength) < 0)
        {
            sipIsErr = 1;
        }
        else
        {
            sipRes = new QStringList();
        
            for (Py_ssize_t 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(QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort) const;
    QStringList entryList(const QStringList &nameFilters, QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort) const;
    QFileInfoList entryInfoList(QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort) const;
    QFileInfoList entryInfoList(const QStringList &nameFilters, QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort) const;
%If (Qt_6_3_0 -)
    bool mkdir(const QString &dirName, QFileDevice::Permissions permissions) const;
%End
    bool mkdir(const QString &dirName) const;
    bool rmdir(const QString &dirName) const;
%If (Qt_6_10_0 -)
    // We choose to make the permissions argument compulsory (to be consistent with
    // the existing mkdir() behaviour rather than adopt the new mkdir() and mkpath()
    // behaviour.
    bool mkpath(const QString &dirPath, QFileDevice::Permissions permissions) const;
%End
    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();
%If (- Qt_6_8_0)
    bool operator==(const QDir &dir) const;
%End
%If (- Qt_6_8_0)
    bool operator!=(const QDir &dir) const;
%End
    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);
    static QString toNativeSeparators(const QString &pathName);
    static QString fromNativeSeparators(const QString &pathName);
    static void setSearchPaths(const QString &prefix, const QStringList &searchPaths);
    static void addSearchPath(const QString &prefix, const QString &path);
    static QStringList searchPaths(const QString &prefix);
    bool removeRecursively();
    void swap(QDir &other /Constrained/);
    static QChar listSeparator();
    bool isEmpty(QDir::Filters filters = QDir::Filters(QDir::AllEntries | QDir::NoDotAndDotDot)) const;
};

%If (Qt_6_8_0 -)
bool operator!=(const QDir &lhs, const QDir &rhs);
%End
%If (Qt_6_8_0 -)
bool operator==(const QDir &lhs, const QDir &rhs);
%End
