lfilesystem
0.0.1
C++ filesystem library
lfilesystem_SimpleWatcher.h
Go to the documentation of this file.
1
/*
2
* ======================================================================================
3
* __ ____ __ __ ____ ___
4
* ( ) (_ _)( \/ )( ___)/ __)
5
* )(__ _)(_ ) ( )__) \__ \
6
* (____)(____)(_/\/\_)(____)(___/
7
*
8
* This file is part of the Limes open source library and is licensed under the terms of the GNU Public License.
9
*
10
* Commercial licenses are available; contact the maintainers at ben.the.vining@gmail.com to inquire for details.
11
*
12
* ======================================================================================
13
*/
14
15
#pragma once
16
17
#include <functional>
18
#include "lfilesystem/lfilesystem_Export.h"
19
#include "
lfilesystem/lfilesystem_FileWatcher.h
"
20
26
namespace
limes::files
27
{
28
37
class
LFILE_EXPORT
SimpleFileWatcher
final :
public
FileWatcher
38
{
39
public
:
46
using
Callback
= std::function<void (
const
FilesystemEntry
&)>;
47
56
explicit
SimpleFileWatcher
(
const
FilesystemEntry
& fileToWatch,
57
Callback
&& callbackToUse);
58
59
private
:
60
void
fileAccessed (
const
FilesystemEntry
& f)
final
;
61
void
fileMetadataChanged (
const
FilesystemEntry
& f)
final
;
62
void
fileHandleClosed (
const
FilesystemEntry
& f)
final
;
63
void
fileCreated (
const
FilesystemEntry
& f)
final
;
64
void
fileDeleted (
const
FilesystemEntry
& f)
final
;
65
void
fileModified (
const
FilesystemEntry
& f)
final
;
66
void
fileMoved (
const
FilesystemEntry
& f)
final
;
67
void
fileOpened (
const
FilesystemEntry
& f)
final
;
68
void
otherEventType (
const
FilesystemEntry
& f)
final
;
69
70
const
Callback
callback;
71
};
72
73
}
// namespace files
limes::files::FileWatcher
This class listens for changes to or operations on a certain file, and receives callbacks to be notif...
Definition:
lfilesystem_FileWatcher.h:68
limes::files::FilesystemEntry
The base class for any kind of object on the filesystem.
Definition:
lfilesystem_FilesystemEntry.h:80
limes::files::SimpleFileWatcher
This class implements all of FileWatcher's virtual methods, and allows you to easily specify a lambda...
Definition:
lfilesystem_SimpleWatcher.h:38
limes::files::SimpleFileWatcher::Callback
std::function< void(const FilesystemEntry &)> Callback
The type of the lambda that will be called for any event type.
Definition:
lfilesystem_SimpleWatcher.h:46
limes::files::SimpleFileWatcher::SimpleFileWatcher
SimpleFileWatcher(const FilesystemEntry &fileToWatch, Callback &&callbackToUse)
Creates a file watcher that will call the given callback for every event type on the watched path.
lfilesystem_FileWatcher.h
This file defines the files::FileWatcher class.
limes::files
Filesystem utilities.
include
lfilesystem
lfilesystem_SimpleWatcher.h
Generated on Sat May 27 2023 19:43:14 for lfilesystem by
1.9.1