103 #include <QtCore/qset.h> 104 #include <QtCore/qstack.h> 105 #include <QtCore/qvariant.h> 107 #include <QtCore/private/qfilesystemiterator_p.h> 108 #include <QtCore/private/qfilesystementry_p.h> 109 #include <QtCore/private/qfilesystemmetadata_p.h> 110 #include <QtCore/private/qfilesystemengine_p.h> 111 #include <QtCore/qfsfileengine.h> 112 #include <QtCore/private/qfileinfo_p.h> 116 template <
class Iterator>
130 QDir::Filters
filters, QDirIterator::IteratorFlags flags,
bool resolveEngine =
true);
135 void pushDirectory(
const QFileInfo &fileInfo);
136 void checkAndPushDirectory(
const QFileInfo &);
151 #ifndef QT_NO_FILESYSTEMITERATOR 166 QDir::Filters
filters, QDirIterator::IteratorFlags flags,
bool resolveEngine)
169 , filters(
QDir::NoFilter == filters ?
QDir::AllEntries : filters)
170 , iteratorFlags(flags)
174 for (
int i = 0; i < nameFilters.
size(); ++i)
215 #ifndef QT_NO_FILESYSTEMITERATOR 257 #ifndef QT_NO_FILESYSTEMITERATOR 291 if (!fileInfo.
isDir())
334 const int fileNameSize = fileName.
size();
335 const bool dotOrDotDot = fileName[0] ==
QLatin1Char(
'.')
336 && ((fileNameSize == 1)
337 ||(fileNameSize == 2 && fileName[1] ==
QLatin1Char(
'.')));
349 bool matched =
false;
352 iter !=
end; ++iter) {
354 if (iter->exactMatch(fileName)) {
368 if(!includeSystem || fi.
exists())
374 if (!includeHidden && !dotOrDotDot && fi.
isHidden())
384 if (skipDirs && fi.
isDir())
389 if (skipFiles && fi.
isFile())
399 if (filterPermissions
427 class MyQDir :
public QDir {
public:
const QDirPrivate *
priv()
const {
return d_ptr.constData(); } };
481 QDir::Filters
filters, IteratorFlags flags)
520 #ifndef QT_NO_FILESYSTEMITERATOR bool isNull() const
Returns true if this object is holding a pointer that is null.
The QDir class provides access to directory structures and their contents.
QFileInfo currentFileInfo
QFileSystemEntry fileEntry
bool isHidden() const
Returns true if this is a `hidden' file; otherwise returns false.
static mach_timebase_info_data_t info
#define QT_END_NAMESPACE
This macro expands to.
virtual ~QDirIterator()
Destroys the QDirIterator.
bool hasNext() const
Returns true if there is at least one more entry in the directory; otherwise, false is returned...
The QRegExp class provides pattern matching using regular expressions.
#define it(className, varName)
QDirIterator(const QDir &dir, IteratorFlags flags=NoIteratorFlags)
Constructs a QDirIterator that can iterate over dir's entrylist, using dir's name filters and regular...
QFileSystemEntry dirEntry
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the vector...
QString fileName() const
Returns the name of the file, excluding the path.
QScopedPointer< QDirIteratorPrivate > d
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool exists() const
Returns true if the file exists; otherwise returns false.
QSharedDataPointer< QFileInfoPrivate > d_ptr
The QStack class is a template class that provides a stack.
The QString class provides a Unicode character string.
QFileInfo fileInfo() const
Returns a QFileInfo for the current directory entry.
void pushDirectory(const QFileInfo &fileInfo)
QScopedPointer< QAbstractFileEngine > fileEngine
virtual void setFileName(const QString &file)
Sets the file engine's file name to file.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
QString path() const
Returns the base directory of the iterator.
T pop()
Removes the top item from the stack and returns it.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the vector.
QString fileName() const
Returns the file name for the current directory entry, without the path prepended.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QDirIteratorPrivateIteratorStack< QAbstractFileEngineIterator > fileEngineIterators
bool isDir() const
Returns true if this object points to a directory or to a symbolic link to a directory; otherwise ret...
bool contains(const T &value) const
int size() const
Returns the number of characters in this string.
~QDirIteratorPrivateIteratorStack()
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QVector< QRegExp > nameRegExps
const T & at(int i) const
Returns the item at index position i in the list.
bool entryMatches(const QString &fileName, const QFileInfo &fileInfo)
The QStringList class provides a list of strings.
QString canonicalFilePath() const
Returns the canonical path including the file name, i.e.
void append(const T &t)
Inserts value at the end of the vector.
bool isExecutable() const
Returns true if the file is executable; otherwise returns false.
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
virtual bool hasNext() const =0
This pure virtual function returns true if there is at least one more entry in the current directory ...
bool advance(QFileSystemEntry &fileEntry, QFileSystemMetaData &metaData)
void reset(T *other=0)
Deletes the existing object it is pointing to if any, and sets its pointer to other.
void setPath(const QString &path)
Sets the iterator path to path.
virtual Iterator * beginEntryList(QDir::Filters filters, const QStringList &filterNames)
Returns an instance of a QAbstractFileEngineIterator using filters for entry filtering and filterName...
static const char *const filters[3]
QString next()
Advances the iterator to the next entry, and returns the file path of this new entry.
bool matchesFilters(const QString &fileName, const QFileInfo &fi) const
This convenience function implements the iterator's filtering logics and applies then to the current ...
QScopedPointer< QAbstractFileEngine > engine
void checkAndPushDirectory(const QFileInfo &)
int size() const
Returns the number of items in the list.
The QAbstractFileEngineIterator class provides an iterator interface for custom file engines...
bool isFile() const
Returns true if this object points to a file or to a symbolic link to a file.
virtual QString next()=0
This pure virtual function advances the iterator to the next directory entry, and returns the file pa...
bool contains(const T &t) const
Returns true if the vector contains an occurrence of value; otherwise returns false.
const QDirIterator::IteratorFlags iteratorFlags
QDirIteratorPrivateIteratorStack< QFileSystemIterator > nativeIterators
virtual QString currentFileName() const =0
This pure virtual function returns the name of the current directory entry, excluding the path...
const QStringList nameFilters
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
static QAbstractFileEngine * resolveEntryAndCreateLegacyEngine(QFileSystemEntry &entry, QFileSystemMetaData &data)
Resolves the entry (see QDir::searchPaths) and returns an engine for it, but never a QFSFileEngine...
void reserve(int size)
Attempts to allocate memory for at least size elements.
bool isReadable() const
Returns true if the user can read the file; otherwise returns false.
QString filePath() const
Returns the full file path for the current directory entry.
bool isSymLink() const
Returns true if this object points to a symbolic link (or to a shortcut on Windows); otherwise return...
The QFileInfo class provides system-independent file information.
static const KeyPair *const end
QString filePath() const
Returns the file name, including the path (which may be absolute or relative).
static QString fileName(const QString &fileUrl)
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
bool isWritable() const
Returns true if the user can write to the file; otherwise returns false.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QSet< QString > visitedLinks
virtual QFileInfo currentFileInfo() const
The virtual function returns a QFileInfo for the current directory entry.
const QDir::Filters filters
QFileSystemEntry dirEntry
T & top()
Returns a reference to the stack's top item.
QDirIteratorPrivate(const QFileSystemEntry &entry, const QStringList &nameFilters, QDir::Filters filters, QDirIterator::IteratorFlags flags, bool resolveEngine=true)