glibmm
2.42.0
|
Utility class representing an open directory. More...
#include <glibmm/fileutils.h>
Public Types | |
typedef DirIterator | iterator |
typedef DirIterator | const_iterator |
Public Member Functions | |
Dir (const std::string& path) | |
Opens a directory for reading. More... | |
~Dir () | |
Closes the directory and deallocates all related resources. More... | |
std::string | read_name () |
Retrieves the name of the next entry in the directory. More... | |
void | rewind () |
Resets the directory. More... | |
void | close () |
Closes the directory and deallocates all related resources. More... | |
DirIterator | begin () |
Get the begin of an input iterator sequence. More... | |
DirIterator | end () |
Get the end of an input iterator sequence. More... | |
Utility class representing an open directory.
It's highly recommended to use the iterator interface. With iterators, reading an entire directory into a STL container is really easy:
typedef DirIterator Glib::Dir::const_iterator |
typedef DirIterator Glib::Dir::iterator |
|
explicit |
Opens a directory for reading.
The names of the files in the directory can then be retrieved using read_name().
path | The path to the directory you are interested in. |
Glib::FileError |
Glib::Dir::~Dir | ( | ) |
Closes the directory and deallocates all related resources.
DirIterator Glib::Dir::begin | ( | ) |
Get the begin of an input iterator sequence.
void Glib::Dir::close | ( | ) |
DirIterator Glib::Dir::end | ( | ) |
Get the end of an input iterator sequence.
std::string Glib::Dir::read_name | ( | ) |
void Glib::Dir::rewind | ( | ) |
Resets the directory.
The next call to read_name() will return the first entry again.