Poco

class DirectoryIterator

File Information

Library: Foundation
Package: Filesystem
Header: Poco/DirectoryIterator.h

Description

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

Inheritance

Known Derived Classes: SortedDirectoryIterator

Member Summary

Member Functions: name, operator !=, operator *, operator ++, operator =, operator ==, operator->, path

Constructors

DirectoryIterator

DirectoryIterator();

Creates the end iterator.

DirectoryIterator

DirectoryIterator(
    const std::string & path
);

Creates a directory iterator for the given path.

DirectoryIterator

DirectoryIterator(
    const DirectoryIterator & iterator
);

Creates a directory iterator for the given path.

DirectoryIterator

DirectoryIterator(
    const File & file
);

Creates a directory iterator for the given file.

DirectoryIterator

DirectoryIterator(
    const Path & path
);

Creates a directory iterator for the given path.

Destructor

~DirectoryIterator virtual

virtual ~DirectoryIterator();

Destroys the DirectoryIterator.

Member Functions

name inline

const std::string & name() const;

Returns the current filename.

operator != inline

bool operator != (
    const DirectoryIterator & iterator
) const;

operator * inline

const File & operator * () const;

operator *

File & operator * ();

operator ++ virtual

virtual DirectoryIterator & operator ++ ();

operator ++

DirectoryIterator operator ++ (
    int
);

Deprecated. This function issc_deprecated.

Please use the prefix increment operator instead.

operator =

DirectoryIterator & operator = (
    const DirectoryIterator & it
);

operator =

DirectoryIterator & operator = (
    const File & file
);

operator =

DirectoryIterator & operator = (
    const Path & path
);

operator =

DirectoryIterator & operator = (
    const std::string & path
);

operator == inline

bool operator == (
    const DirectoryIterator & iterator
) const;

operator-> inline

const File * operator-> () const;

operator->

File * operator-> ();

path inline

const Path & path() const;

Returns the current path.

Variables

_file protected

File _file;

_path protected

Path _path;

Securely control IoT edge devices from anywhere   Connect a Device