libnick 2024.12.0
A cross-platform base for native Nickvision applications.
|
A watcher of a file system folder. More...
#include <filesystemwatcher.h>
Public Member Functions | |
FileSystemWatcher (const std::filesystem::path &path, bool includeSubdirectories, WatcherFlags watcherFlags=WatcherFlags::FileName|WatcherFlags::DirectoryName|WatcherFlags::Attributes|WatcherFlags::Size|WatcherFlags::LastWrite|WatcherFlags::LastAccess) | |
Constructs a FileSystemWatcher. | |
~FileSystemWatcher () | |
Destructs a FileSystemWatcher. | |
const std::filesystem::path & | getPath () const |
Gets the path of the folder being watched. | |
WatcherFlags | getWatcherFlags () const |
Gets the flags of what to watch changes for. | |
bool | getIncludeSubdirectories () const |
Gets whether or not subdirectories of the folder are watched. | |
Events::Event< FileSystemChangedEventArgs > & | changed () |
Gets the event for when a watched flag of the folder is changed. | |
bool | isExtensionWatched (const std::filesystem::path &extension) |
Gets whether or not a file extension is being watched. | |
bool | addExtensionFilter (const std::filesystem::path &extension) |
Adds an extension of a file to watch for changes in the folder. | |
bool | removeExtensionFilter (const std::filesystem::path &extension) |
Removes an extension of a file to watch for changes in the folder. | |
bool | clearExtensionFilters () |
Clears all watched extension filters. This will cause all extensions to be implicitly watched. | |
A watcher of a file system folder.
Nickvision::Filesystem::FileSystemWatcher::FileSystemWatcher | ( | const std::filesystem::path & | path, |
bool | includeSubdirectories, | ||
WatcherFlags | watcherFlags = WatcherFlags::FileName|WatcherFlags::DirectoryName|WatcherFlags::Attributes|WatcherFlags::Size|WatcherFlags::LastWrite|WatcherFlags::LastAccess ) |
Constructs a FileSystemWatcher.
path | The path of the folder to watch |
includeSubdirectories | Whether or not to include subdirectories for the folder |
watcherFlags | The flags of what to watch changes for |
std::runtime_error | Thrown if unable to initialize watcher |
Nickvision::Filesystem::FileSystemWatcher::~FileSystemWatcher | ( | ) |
Destructs a FileSystemWatcher.
bool Nickvision::Filesystem::FileSystemWatcher::addExtensionFilter | ( | const std::filesystem::path & | extension | ) |
Adds an extension of a file to watch for changes in the folder.
extension | The file extension to add |
Events::Event< FileSystemChangedEventArgs > & Nickvision::Filesystem::FileSystemWatcher::changed | ( | ) |
Gets the event for when a watched flag of the folder is changed.
bool Nickvision::Filesystem::FileSystemWatcher::clearExtensionFilters | ( | ) |
Clears all watched extension filters. This will cause all extensions to be implicitly watched.
bool Nickvision::Filesystem::FileSystemWatcher::getIncludeSubdirectories | ( | ) | const |
Gets whether or not subdirectories of the folder are watched.
const std::filesystem::path & Nickvision::Filesystem::FileSystemWatcher::getPath | ( | ) | const |
Gets the path of the folder being watched.
WatcherFlags Nickvision::Filesystem::FileSystemWatcher::getWatcherFlags | ( | ) | const |
Gets the flags of what to watch changes for.
bool Nickvision::Filesystem::FileSystemWatcher::isExtensionWatched | ( | const std::filesystem::path & | extension | ) |
Gets whether or not a file extension is being watched.
extension | The file extension to check |
bool Nickvision::Filesystem::FileSystemWatcher::removeExtensionFilter | ( | const std::filesystem::path & | extension | ) |
Removes an extension of a file to watch for changes in the folder.
extension | The file extension to remove |