class Poco::DirectoryIterator
Overview
The DirectoryIterator class is used to enumerate all files in a directory. Moreā¦
#include <DirectoryIterator.h> class DirectoryIterator { public: // construction DirectoryIterator(); DirectoryIterator(const std::string& path); DirectoryIterator(const DirectoryIterator& iterator); DirectoryIterator(const File& file); DirectoryIterator(const Path& path); // methods const std::string& name() const; const Path& path() const; DirectoryIterator& operator=(const DirectoryIterator& it); DirectoryIterator& operator=(const File& file); DirectoryIterator& operator=(const Path& path); DirectoryIterator& operator=(const std::string& path); virtual DirectoryIterator& operator++(); DirectoryIterator operator++(int); const File& operator*() const; File& operator*(); const File* operator->() const; File* operator->(); bool operator==(const DirectoryIterator& iterator) const; bool operator!=(const DirectoryIterator& iterator) const; protected: // fields Path _path; File _file; }; // direct descendants class SortedDirectoryIterator;
Detailed Documentation
The DirectoryIterator class is used to enumerate all files in a directory.
DirectoryIterator 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) * because of this you should only use the prefix increment operator
Construction
DirectoryIterator()
Creates the end iterator.
DirectoryIterator(const std::string& path)
Creates a directory iterator for the given path.
DirectoryIterator(const DirectoryIterator& iterator)
Creates a directory iterator for the given path.
DirectoryIterator(const File& file)
Creates a directory iterator for the given file.
DirectoryIterator(const Path& path)
Creates a directory iterator for the given path.