Directory scanning class.
More...
#include <directory_scanner.h>
Directory scanning class.
DirectoryScanner is used to parse through directory trees and return information about files.
Example that prints all files and directories found in the root directory:
DirectoryScanner scanner; if (scanner.scan("/", "*")) { while (scanner.next()) { auto name = scanner.name(); } }
Constructs directory scanner for iterating over a directory.
virtual std::string uicore::DirectoryScanner::directory_path |
( |
| ) |
|
|
pure virtual |
Gets the directory being scanned.
- Returns
- Directory being scanned. (including the trailing slash)
virtual bool uicore::DirectoryScanner::is_directory |
( |
| ) |
|
|
pure virtual |
Returns true if the current file is a directory.
- Returns
- True if filename is a directory.
virtual bool uicore::DirectoryScanner::is_hidden |
( |
| ) |
|
|
pure virtual |
Returns true if the file is hidden.
- Returns
- True if filename is hidden.
virtual bool uicore::DirectoryScanner::is_readable |
( |
| ) |
|
|
pure virtual |
Returns true if the file is readable by the current user.
- Returns
- True if the file is readable.
virtual bool uicore::DirectoryScanner::is_writable |
( |
| ) |
|
|
pure virtual |
Returns true if the file is writable by the current user.
- Returns
- True if the file is writable.
Gets the name of the current file.
- Returns
- The name of the current found file.
virtual bool uicore::DirectoryScanner::next |
( |
| ) |
|
|
pure virtual |
Find next file in directory scan.
- Returns
- false if no more files was found.
virtual std::string uicore::DirectoryScanner::pathname |
( |
| ) |
|
|
pure virtual |
Gets the pathname of the current file.
- Returns
- The name of the current found file, including the directory path.
virtual bool uicore::DirectoryScanner::scan |
( |
const std::string & |
pathname | ) |
|
|
pure virtual |
Selects the directory to scan through.
Selects the directory to scan through
- Parameters
-
pathname | Path to the directory to scan (without trailing slash) |
- Returns
- true if the directory can be accessed.
Selects the directory to scan through.
Selects the directory to scan through and use a matching pattern on the files. WIN32: The pattern is normal DOS pattern matching ("*.*", ?) Unix: The pattern is normal pattern matching (*, ?)
- Parameters
-
pathname | Path to the directory to scan (without trailing slash) |
pattern | Pattern to match files against. |
- Returns
- true if the directory can be accessed.
virtual int uicore::DirectoryScanner::size |
( |
| ) |
|
|
pure virtual |
Gets the size of the current file.
- Returns
- The size of the current found file.
The documentation for this class was generated from the following file: