openMSX
Classes | Public Member Functions | List of all members
openmsx::ReadDir Class Reference

Simple wrapper around opendir() / readdir() / closedir() functions. More...

#include <ReadDir.hh>

Public Member Functions

 ReadDir (zstring_view directory)
 
struct dirent * getEntry ()
 Get directory entry for next file.
 
bool isValid () const
 Is the given directory valid (does it exist)?
 

Detailed Description

Simple wrapper around opendir() / readdir() / closedir() functions.

Mainly useful to automatically call closedir() when object goes out of scope.

Definition at line 17 of file ReadDir.hh.

Constructor & Destructor Documentation

◆ ReadDir()

openmsx::ReadDir::ReadDir ( zstring_view  directory)
inlineexplicit

Definition at line 20 of file ReadDir.hh.

Member Function Documentation

◆ getEntry()

struct dirent * openmsx::ReadDir::getEntry ( )
inline

Get directory entry for next file.

Returns nullptr when there are no more entries or in case of error (e.g. given directory does not exist).

Definition at line 27 of file ReadDir.hh.

Referenced by openmsx::FileOperations::deleteRecursive(), openmsx::detail::foreach_dirent(), and openmsx::FileOperations::getNextNumberedFileName().

◆ isValid()

bool openmsx::ReadDir::isValid ( ) const
inline

Is the given directory valid (does it exist)?

Definition at line 34 of file ReadDir.hh.


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