Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtCore.QDirIterator Class Reference

The QDirIterator class provides an iterator for directory entrylists. More...

Inheritance diagram for QtCore.QDirIterator:
Collaboration diagram for QtCore.QDirIterator:

Public Types

enum  IteratorFlag { FollowSymlinks = 1, NoIteratorFlags = 0, Subdirectories = 2 }
  More...
 

Public Member Functions

 QDirIterator (QDir dir, QDirIterator.IteratorFlag flags=QDirIterator.IteratorFlag.NoIteratorFlags)
 
 
 QDirIterator (string path, QDirIterator.IteratorFlag flags=QDirIterator.IteratorFlag.NoIteratorFlags)
 
 
 QDirIterator (string path, QDir.Filter filter, QDirIterator.IteratorFlag flags=QDirIterator.IteratorFlag.NoIteratorFlags)
 
 
 QDirIterator (string path, System.Collections.Generic.List< string > nameFilters, QDir.Filter filters=QDir.Filter.NoFilter, QDirIterator.IteratorFlag flags=QDirIterator.IteratorFlag.NoIteratorFlags)
 
 
virtual void CreateProxy ()
 
new QFileInfo FileInfo ()
 
 
new string FileName ()
 
 
new string FilePath ()
 
 
new bool HasNext ()
 
 
new string Next ()
 
 
new string Path ()
 
 
new void Dispose ()
 

Protected Member Functions

 QDirIterator (System.Type dummy)
 

Protected Attributes

SmokeInvocation interceptor
 

Properties

virtual System.IntPtr SmokeObject [get, set]
 

Detailed Description

The QDirIterator class provides an iterator for directory entrylists.

You can use QDirIterator to navigate entries of a directory one at a time. It is similar to QDir::entryList() and QDir::entryInfoList(), but because it lists entries one at a time instead of all at once, it scales better and is more suitable for large directories. It also supports listing directory contents recursively, and following symbolic links. Unlike QDir::entryList(), QDirIterator does not support sorting.

The QDirIterator constructor takes a QDir or a directory as argument. After construction, the iterator is located before the first directory entry. Here's how to iterate over all the entries sequentially:

QDirIterator it("/etc", QDirIterator::Subdirectories);

while (it.hasNext()) {

qDebug() << it.next();

// /etc/.

// /etc/..

// /etc/X11

// /etc/X11/fs

// ...

}

The next() function returns the path to the next directory entry and advances the iterator. You can also call filePath() to get the current file path without advancing the iterator. The fileName() function returns only the name of the file, similar to how QDir::entryList() works. You can also call fileInfo() to get a QFileInfo for the current entry.

Unlike Qt's container iterators, QDirIterator is uni-directional (i.e., you cannot iterate directories in reverse order) and does not allow random access.

QDirIterator works with all supported file engines, and is implemented using QAbstractFileEngineIterator.

See also QDir, QDir::entryList(), and QAbstractFileEngineIterator.

Member Enumeration Documentation

This enum describes flags that you can combine to configure the behavior of QDirIterator.

Enumerator:
FollowSymlinks 

When combined with Subdirectories, this flag enables iterating through all subdirectories of the assigned path, following all symbolic links. Symbolic link loops (e.g., "link" => "." or "link" => "..") are automatically detected and ignored.

NoIteratorFlags 

The default value, representing no flags. The iterator will return entries for the assigned path.

Subdirectories 

List entries inside all subdirectories as well.

Constructor & Destructor Documentation

QtCore.QDirIterator.QDirIterator ( System.Type  dummy)
protected
QtCore.QDirIterator.QDirIterator ( QDir  dir,
QDirIterator.IteratorFlag  flags = QDirIterator.IteratorFlag.NoIteratorFlags 
)

Constructs a QDirIterator that can iterate over dir's entrylist, using dir's name filters and regular filters. You can pass options via flags to decide how the directory should be iterated.

By default, flags is NoIteratorFlags, which provides the same behavior as in QDir::entryList().

The sorting in dir is ignored.

Note: To list symlinks that point to non existing files, QDir::System must be passed to the flags.

See also hasNext(), next(), and IteratorFlags.

QtCore.QDirIterator.QDirIterator ( string  path,
QDirIterator.IteratorFlag  flags = QDirIterator.IteratorFlag.NoIteratorFlags 
)

Constructs a QDirIterator that can iterate over dir's entrylist, using dir's name filters and regular filters. You can pass options via flags to decide how the directory should be iterated.

By default, flags is NoIteratorFlags, which provides the same behavior as in QDir::entryList().

The sorting in dir is ignored.

Note: To list symlinks that point to non existing files, QDir::System must be passed to the flags.

See also hasNext(), next(), and IteratorFlags.

QtCore.QDirIterator.QDirIterator ( string  path,
QDir.Filter  filter,
QDirIterator.IteratorFlag  flags = QDirIterator.IteratorFlag.NoIteratorFlags 
)

Constructs a QDirIterator that can iterate over dir's entrylist, using dir's name filters and regular filters. You can pass options via flags to decide how the directory should be iterated.

By default, flags is NoIteratorFlags, which provides the same behavior as in QDir::entryList().

The sorting in dir is ignored.

Note: To list symlinks that point to non existing files, QDir::System must be passed to the flags.

See also hasNext(), next(), and IteratorFlags.

QtCore.QDirIterator.QDirIterator ( string  path,
System.Collections.Generic.List< string >  nameFilters,
QDir.Filter  filters = QDir.Filter.NoFilter,
QDirIterator.IteratorFlag  flags = QDirIterator.IteratorFlag.NoIteratorFlags 
)

Constructs a QDirIterator that can iterate over dir's entrylist, using dir's name filters and regular filters. You can pass options via flags to decide how the directory should be iterated.

By default, flags is NoIteratorFlags, which provides the same behavior as in QDir::entryList().

The sorting in dir is ignored.

Note: To list symlinks that point to non existing files, QDir::System must be passed to the flags.

See also hasNext(), next(), and IteratorFlags.

Member Function Documentation

virtual void QtCore.QDirIterator.CreateProxy ( )
virtual
new void QtCore.QDirIterator.Dispose ( )
new QFileInfo QtCore.QDirIterator.FileInfo ( )

Returns a QFileInfo for the current directory entry.

See also filePath() and fileName().

new string QtCore.QDirIterator.FileName ( )

Returns the file name for the current directory entry, without the path prepended.

This function is convenient when iterating a single directory. When using the QDirIterator::Subdirectories flag, you can use filePath() to get the full path.

See also filePath() and fileInfo().

new string QtCore.QDirIterator.FilePath ( )

Returns the full file path for the current directory entry.

See also fileInfo() and fileName().

new bool QtCore.QDirIterator.HasNext ( )

Returns true if there is at least one more entry in the directory; otherwise, false is returned.

See also next(), fileName(), filePath(), and fileInfo().

new string QtCore.QDirIterator.Next ( )

Advances the iterator to the next entry, and returns the file path of this new entry. If hasNext() returns false, this function does nothing, and returns a null QString.

You can call fileName() or filePath() to get the current entry file name or path, or fileInfo() to get a QFileInfo for the current entry.

See also hasNext(), fileName(), filePath(), and fileInfo().

new string QtCore.QDirIterator.Path ( )

Returns the base directory of the iterator.

Member Data Documentation

SmokeInvocation QtCore.QDirIterator.interceptor
protected

Property Documentation

virtual System.IntPtr QtCore.QDirIterator.SmokeObject
getset