Deepsolver
Public Types | Public Member Functions
Deepsolver::Directory::Iterator Class Reference

The iterator over the files and subdirectories. More...

List of all members.

Public Types

typedef std::shared_ptr< IteratorPtr

Public Member Functions

std::string fullPath () const
 Returns the name of the directory item this iterator is pointing to with all parent directories.
 Iterator (const std::string &path, DIR *dir)
 The constructor.
bool moveNext ()
 Moves the iterator to next item.
std::string name () const
 Returns the name of the directory item this iterator is pointing to.
virtual ~Iterator ()
 The destructor.

Detailed Description

This class enumerates all items in the directory. Each item can be examined both as just the name of a file and as a full path with all parent directories.

The iterator is created pointed before the first item. Hence, a user has to call moveNext() method at least once to be able call methods providing item information.


Constructor & Destructor Documentation

Deepsolver::Directory::Iterator::Iterator ( const std::string &  path,
DIR *  dir 
) [inline]
Parameters:
[in]pathThe name of the directory to be used for proper full path construction
[in]dirThe valid directory handle to read data from

Member Function Documentation

std::string Directory::Iterator::fullPath ( ) const
Returns:
The full path of the item this iterator is pointing to
bool Deepsolver::Directory::Iterator::moveNext ( )

This method moves the iterator to the first item on its first invocation or to the next on each consequent. The method returns zero if next item does not exist. If method returns zero on first call that means the directory is empty.

Returns:
Non-zero if next item exists or zero otherwise
std::string Directory::Iterator::name ( ) const
Returns:
The name of the item the iterator is pointing