Utility class representing an open directory.
More...
#include <glibmm/fileutils.h>
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:
Utility class representing an open directory.
Definition: fileutils.h:418
- Note
- The encoding of the directory entries isn't necessarily UTF-8. Use Glib::filename_to_utf8() if you need to display them.
◆ const_iterator
◆ iterator
◆ Dir() [1/2]
Opens a directory for reading.
The names of the files in the directory can then be retrieved using read_name().
- Parameters
-
path | The path to the directory you are interested in. |
- Exceptions
-
◆ Dir() [2/2]
Glib::Dir::Dir |
( |
const Dir & |
| ) |
|
|
delete |
◆ ~Dir()
Closes the directory and deallocates all related resources.
◆ begin()
Get the begin of an input iterator sequence.
- Returns
- An input iterator pointing to the first directory entry.
◆ close()
void Glib::Dir::close |
( |
| ) |
|
Closes the directory and deallocates all related resources.
Note that close() is implicitely called by ~Dir(). Thus you don't need to call close() yourself unless you want to close the directory before the destructor runs.
◆ end()
Get the end of an input iterator sequence.
- Returns
- An input iterator pointing behind the last directory entry.
◆ operator=()
Dir& Glib::Dir::operator= |
( |
const Dir & |
| ) |
|
|
delete |
◆ read_name()
Retrieves the name of the next entry in the directory.
The '.'
and '..'
entries are omitted.
- Returns
- The entry's name or
""
if there are no more entries.
- See also
- begin(), end()
◆ rewind()
void Glib::Dir::rewind |
( |
| ) |
|
Resets the directory.
The next call to read_name() will return the first entry again.