dtkio
dtk library for dtkio.
载入中...
搜索中...
未找到
denumerator.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DENUMERATOR_H
6#define DENUMERATOR_H
7
8#include <QUrl>
9#include <QScopedPointer>
10
11#include <DError>
12#include <DExpected>
13
14#include "dtkio_global.h"
15#include "dtkiotypes.h"
16
17DIO_BEGIN_NAMESPACE
18class DFileFuture;
19class DFileInfo;
20class DEnumeratorPrivate;
22{
23public:
24 explicit DEnumerator(const QUrl &url);
26
27 DTK_CORE_NAMESPACE::DExpected<QUrl> url() const;
28
29 DTK_CORE_NAMESPACE::DExpected<void> setNameFilters(const QStringList &nameFilters);
30 DTK_CORE_NAMESPACE::DExpected<void> setDirFilters(DirFilters dirFilters);
31 DTK_CORE_NAMESPACE::DExpected<void> setIteratorFlags(IteratorFlags flags);
32 DTK_CORE_NAMESPACE::DExpected<QStringList> nameFilters() const;
33 DTK_CORE_NAMESPACE::DExpected<DirFilters> dirFilters() const;
34 DTK_CORE_NAMESPACE::DExpected<IteratorFlags> iteratorFlags() const;
35 DTK_CORE_NAMESPACE::DExpected<void> setTimeout(quint64 timeout);
36 DTK_CORE_NAMESPACE::DExpected<quint64> timeout() const;
37
38 DTK_CORE_NAMESPACE::DExpected<bool> createEnumerator();
39 [[nodiscard]] DFileFuture *createEnumeratorAsync(int ioPriority, QObject *parent = nullptr);
40
41 DTK_CORE_NAMESPACE::DExpected<bool> hasNext() const;
42 DTK_CORE_NAMESPACE::DExpected<QUrl> next() const;
43
44 DTK_CORE_NAMESPACE::DExpected<quint64> fileCount();
45 [[nodiscard]] DFileInfo *createFileInfo(QObject *parent = nullptr) const;
46
47 DTK_CORE_NAMESPACE::DError lastError() const;
48
49private:
50 QScopedPointer<DEnumeratorPrivate> d;
51};
52DIO_END_NAMESPACE
53
54#endif // DENUMERATOR_H
允许您对一组进行操作DFiles
Definition denumerator.h:22
DTK_CORE_NAMESPACE::DExpected< quint64 > timeout() const
获取超时时间
DFileInfo * createFileInfo(QObject *parent=nullptr) const
创建DFileInfo对象
DTK_CORE_NAMESPACE::DExpected< DirFilters > dirFilters() const
获取目录过滤器
DTK_CORE_NAMESPACE::DExpected< QUrl > next() const
先返回游标指向的下一个元素,游标再移到该位置
DTK_CORE_NAMESPACE::DExpected< void > setNameFilters(const QStringList &nameFilters)
设置名字过滤器
DTK_CORE_NAMESPACE::DExpected< QUrl > url() const
获取当前对象的url
DTK_CORE_NAMESPACE::DExpected< void > setIteratorFlags(IteratorFlags flags)
设置迭代器标志
DTK_CORE_NAMESPACE::DExpected< void > setTimeout(quint64 timeout)
设置超时时间
DFileFuture * createEnumeratorAsync(int ioPriority, QObject *parent=nullptr)
异步创建枚举器
DTK_CORE_NAMESPACE::DExpected< void > setDirFilters(DirFilters dirFilters)
设置目录过滤器
DTK_CORE_NAMESPACE::DExpected< bool > hasNext() const
是否迭代完毕
DTK_CORE_NAMESPACE::DExpected< QStringList > nameFilters() const
获取名字过滤器
DTK_CORE_NAMESPACE::DExpected< bool > createEnumerator()
创建枚举器
DTK_CORE_NAMESPACE::DError lastError() const
返回最新错误
DTK_CORE_NAMESPACE::DExpected< quint64 > fileCount()
获取文件的数量
DTK_CORE_NAMESPACE::DExpected< IteratorFlags > iteratorFlags() const
获取迭代器标志
DEnumerator(const QUrl &url)
构造函数, 通过 info 构造一个新的 DEnumerator 对象
处理文件异步操作的结果
Definition dfilefuture.h:18
用以获取文件的信息
Definition dfileinfo.h:23