nx_server_plugin_sdk 1.0 Server Plugin 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

  dirPath | Directory to iterate

## Member Function Documentation

## ◆ next()

bool DirIterator::next | ( |  | ) |

Moves iterator to the next entry.

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

## ◆ setEntryTypeFilter()

void DirIterator::setEntryTypeFilter | ( | unsigned int | entryTypeMask | ) |

Filter found entries by entry type.

By default, all entries are found

Parameters

  entryTypeMask | Bit OR- field containing bits of EntryType enumeration

## ◆ setWildCardMask()

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

By default, no mask is applied

Parameters

  wildcardMask | Enable filtering by wildcardMask. Empty string - no mask

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

- samples/device/image_library_plugin/src/dir_iterator.h
- samples/device/image_library_plugin/src/dir_iterator.cpp