Directory scanning class. More...
#include <directory_scanner.h>
Public Member Functions | |
Construction | |
| DirectoryScanner () | |
| Constructs directory scanner for iterating over a directory. More... | |
| ~DirectoryScanner () | |
| Destructor. More... | |
Attributes | |
| std::string | get_directory_path () |
| Gets the directory being scanned. More... | |
| std::string | get_name () |
| Gets the name of the current file. More... | |
| int | get_size () |
| Gets the size of the current file. More... | |
| std::string | get_pathname () |
| Gets the pathname of the current file. More... | |
| bool | is_directory () |
| Returns true if the current file is a directory. More... | |
| bool | is_hidden () |
| Returns true if the file is hidden. More... | |
| bool | is_readable () |
| Returns true if the file is readable by the current user. More... | |
| bool | is_writable () |
| Returns true if the file is writable by the current user. More... | |
Operations | |
| bool | scan (const std::string &pathname) |
| Selects the directory to scan through. More... | |
| bool | scan (const std::string &pathname, const std::string &pattern) |
| Selects the directory to scan through. More... | |
| bool | next () |
| Find next file in directory scan. More... | |
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()) { cl_console_write_line(scanner.get_name()); } }