nx_camera_sdk  1.0
Camera SDK
Public Member Functions | List of all members
DirIterator Class Reference

Iterates through contents of specified directory. More...

#include <dir_iterator.h>

Public Member Functions

 DirIterator (const std::string &dirPath)
 
void setRecursive (bool _recursive)
 Enable/disable reading child directories. By default recursive mode is off.
 
void setWildCardMask (const std::string &wildcardMask)
 
void setEntryTypeFilter (unsigned int entryTypeMask)
 Filter found entries by entry type. More...
 
bool next ()
 Moves iterator to the next entry. More...
 
std::string entryPath () const
 Returns path to current entry (path relative to dirPath, specified at initialization)
 
std::string entryFullPath () const
 Returns "search dir path" / "entry path".
 
FsEntryType::Value entryType () const
 
uint64_t entrySize () const
 

Detailed Description

Iterates through contents of specified directory.

Example of usage:

{*.cpp}
for( DirIterator it("/home"); it.next(); )
{
//found it.name();
}
Note
Class is not thread-safe
During search entries '.' and '..' are skipped

Constructor & Destructor Documentation

◆ DirIterator()

DirIterator::DirIterator ( const std::string &  dirPath)

Initially, iterator is pointing to some undefined position

Parameters
dirPathDirectory to iterate

Member Function Documentation

◆ next()

bool DirIterator::next ( )

Moves iterator to the next entry.

Returns
true, if next found, false - if no entries satisfuying search criteria

◆ setEntryTypeFilter()

void DirIterator::setEntryTypeFilter ( unsigned int  entryTypeMask)

Filter found entries by entry type.

By default, all entries are found

Parameters
entryTypeMaskBit OR- field containing bits of EntryType enumeration

◆ setWildCardMask()

void DirIterator::setWildCardMask ( const std::string &  wildcardMask)

By default, no mask is applied

Parameters
wildcardMaskEnable filtering by wildcardMask. Empty string - no mask

The documentation for this class was generated from the following files: