1/*
2 SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5*/
6
7#ifndef FILTEREDDIRITERATOR_H
8#define FILTEREDDIRITERATOR_H
9
10#include <QDirIterator>
11#include <QFileInfo>
12#include <QStack>
13
14namespace Baloo {
15
16class FileIndexerConfig;
17
18class FilteredDirIterator
19{
20public:
21 enum Filter {
22 FilesAndDirs,
23 DirsOnly,
24 };
25 FilteredDirIterator(const FileIndexerConfig* config, const QString& folder, Filter filter = FilesAndDirs);
26 ~FilteredDirIterator();
27
28 FilteredDirIterator(const FilteredDirIterator &) = delete;
29 FilteredDirIterator &operator=(const FilteredDirIterator &) = delete;
30
31 QString next();
32 QString filePath() const;
33 QFileInfo fileInfo() const;
34
35private:
36 const FileIndexerConfig* m_config;
37
38 QDirIterator* m_currentIter;
39 QStack<QString> m_paths;
40 QDir::Filters m_filters;
41
42 QString m_filePath;
43 QFileInfo m_fileInfo;
44 bool m_firstItem;
45};
46
47}
48
49#endif // FILTEREDDIRITERATOR_H
50

source code of baloo/src/file/filtereddiriterator.h