File Information
Library: Foundation
Package: Filesystem
Header: Poco/RecursiveDirectoryIterator.h
Description
The RecursiveDirectoryIterator class is used to enumerate all files in a directory and its subdirectories.
RecursiveDirectoryIterator has some limitations:
- only forward iteration (++) is supported
- an iterator copied from another one will always point to the same file as the original iterator, even is the original iterator has been advanced (all copies of an iterator share their state with the original iterator)
The class can follow different traversal strategies:
- depth-first strategy;
- siblings-first strategy.
The strategies are set by template parameter. There are two corresponding typedefs:
The depth of traversal can be limited by constructor parameter maxDepth (which sets the infinite depth by default).
Member Summary
Member Functions: depth, maxDepth, name, operator !=, operator *, operator ++, operator =, operator ==, operator->, path
Types
MyType
typedef RecursiveDirectoryIterator < TTravStr > MyType;
Enumerations
Anonymous
D_INFINITE = 0
Constant for infinite traverse depth.
Constructors
RecursiveDirectoryIterator
Creates the end iterator.
RecursiveDirectoryIterator
RecursiveDirectoryIterator(
const MyType & iterator
);
Creates a copy of another recursive directory iterator.
RecursiveDirectoryIterator
RecursiveDirectoryIterator(
const std::string & path,
UInt16 maxDepth = D_INFINITE
);
Creates a recursive directory iterator for the given path.
RecursiveDirectoryIterator
RecursiveDirectoryIterator(
const DirectoryIterator & iterator,
UInt16 maxDepth = D_INFINITE
);
Creates a recursive directory iterator for the path of non-recursive directory iterator.
RecursiveDirectoryIterator
RecursiveDirectoryIterator(
const File & file,
UInt16 maxDepth = D_INFINITE
);
Creates a recursive directory iterator for the given path.
RecursiveDirectoryIterator
RecursiveDirectoryIterator(
const Path & path,
UInt16 maxDepth = D_INFINITE
);
Creates a recursive directory iterator for the given path.
Destructor
~RecursiveDirectoryIterator
~RecursiveDirectoryIterator();
Destroys the DirectoryIterator.
Member Functions
depth
UInt16 depth() const;
Depth of recursion (counting from 1).
maxDepth
UInt16 maxDepth() const;
Max depth of recursion (counting from 1).
name
const std::string & name() const;
Returns the current filename.
operator !=
template < class T1, class T2 > friend inline bool operator != (
const RecursiveDirectoryIterator < T1 > & a,
const RecursiveDirectoryIterator < T2 > & b
);
operator *
const File & operator * () const;
operator *
File & operator * ();
operator ++
MyType & operator ++ ();
operator =
MyType & operator = (
const MyType & it
);
operator =
MyType & operator = (
const File & file
);
operator =
MyType & operator = (
const Path & path
);
operator =
MyType & operator = (
const std::string & path
);
operator ==
template < class T1, class T2 > friend inline bool operator == (
const RecursiveDirectoryIterator < T1 > & a,
const RecursiveDirectoryIterator < T2 > & b
);
operator->
const File * operator-> () const;
operator->
File * operator-> ();
path
const Poco::Path & path() const;
Returns the current path.