#include <evo/dir.h>
Directory reader.
- Use this open a directory and step through the files
- Example
int main() {
try {
while (dir.read(filename))
return 0;
}
◆ Directory() [1/2]
Constructor.
- Parameters
-
excep | Whether to enable exceptions on error, default set by Evo config: EVO_EXCEPTIONS |
◆ Directory() [2/2]
Directory |
( |
const char * |
path, |
|
|
bool |
excep = 1 |
|
) |
| |
|
inline |
Constructor to open directory.
- Parameters
-
path | Directory path to open |
excep | Whether to enable exceptions on error, default set by Evo config: EVO_EXCEPTIONS |
◆ chdir()
Change current working directory to currently open directory (Linux/Unix only).
- Returns
- Whether successful, false if directory not open or permission denied
◆ close()
Close currently open directory, if any.
◆ error()
Get error code from last operation.
- Returns
- Error code, ENone for success (no error)
◆ excep() [1/2]
Get whether exceptions are enabled.
- Returns
- Whether exceptions enabled
◆ excep() [2/2]
Set whether exceptions are enabled.
- Parameters
-
val | Whether to enable exceptions |
◆ isopen()
Get whether directory is open.
- Returns
- Whether open
◆ open()
bool open |
( |
const char * |
path | ) |
|
|
inline |
Open directory for reading entries.
- Parameters
-
- Returns
- Whether successful, false on error – call error() for error code
◆ operator SafeBoolType()
operator SafeBoolType |
( |
| ) |
const |
|
inlineinherited |
Safe (explicit) evaluation as bool type.
- This is called when object is directly evaluated as a bool, and is equivalent to: !operator!()
- See SafeBool
◆ operator!()
Negation operator checks whether an error was set by a previous operation.
- Call error() to get last error code
- Alternatively, use SafeBool evaluation to check whether previous operations were successful
- Returns
- Whether last operation set an error
◆ read()
Read next directory entry.
- Call seek() to move back to the first entry
- Caution: Result string will reference internal memory that will be invalid on next read() or on close()
- Parameters
-
entry | SubString to store the entry, set to null after last entry [out] |
- Returns
- Whether entry read, false if no more entries
◆ seek()
Seek to beginning of directory.
- After this read() will return entries from the beginning
The documentation for this class was generated from the following file: