![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Polls a single file for modification-time changes. More...
#include <FileWatcher.h>
Public Member Functions | |
| FileWatcher () | |
| Constructs a FileWatcher that is not yet watching any file. | |
| FileWatcher (const std::string &path) | |
Constructs a FileWatcher and immediately begins watching path. | |
| void | Watch (const std::string &path) |
Starts watching path, recording the current modification time. | |
| bool | HasChanged () |
| Returns true if the file's modification time has changed since the last Watch() or Reset() call. | |
| void | Reset () |
| Resets the baseline modification timestamp to the current file time. | |
| const std::string & | GetPath () const |
| Returns the path currently being watched. | |
| bool | IsWatching () const |
| Returns true if a path has been set via Watch() or the path constructor. | |
Static Private Member Functions | |
| static time_t | GetFileModTime (const std::string &path) |
| Platform-portable wrapper around stat() / _stat(). | |
Private Attributes | |
| std::string | m_Path |
| time_t | m_LastModified |
| bool | m_IsWatching |
Polls a single file for modification-time changes.
Typical usage:
Definition at line 43 of file FileWatcher.h.
| Olympe::FileWatcher::FileWatcher | ( | ) |
Constructs a FileWatcher that is not yet watching any file.
Definition at line 23 of file FileWatcher.cpp.
|
explicit |
Constructs a FileWatcher and immediately begins watching path.
Definition at line 29 of file FileWatcher.cpp.
References Watch().
Here is the call graph for this function:Platform-portable wrapper around stat() / _stat().
Definition at line 80 of file FileWatcher.cpp.
References GetComponentTypeID_Static().
Referenced by HasChanged(), Reset(), and Watch().
Here is the call graph for this function:
Here is the caller graph for this function:| const std::string & Olympe::FileWatcher::GetPath | ( | ) | const |
Returns the path currently being watched.
Definition at line 66 of file FileWatcher.cpp.
References m_Path.
| bool Olympe::FileWatcher::HasChanged | ( | ) |
Returns true if the file's modification time has changed since the last Watch() or Reset() call.
Definition at line 47 of file FileWatcher.cpp.
References GetComponentTypeID_Static(), GetFileModTime(), m_IsWatching, m_LastModified, and m_Path.
Here is the call graph for this function:| bool Olympe::FileWatcher::IsWatching | ( | ) | const |
Returns true if a path has been set via Watch() or the path constructor.
Definition at line 71 of file FileWatcher.cpp.
References m_IsWatching.
| void Olympe::FileWatcher::Reset | ( | ) |
Resets the baseline modification timestamp to the current file time.
Definition at line 56 of file FileWatcher.cpp.
References GetFileModTime(), m_IsWatching, m_LastModified, and m_Path.
Here is the call graph for this function:Starts watching path, recording the current modification time.
Definition at line 40 of file FileWatcher.cpp.
References GetFileModTime(), m_IsWatching, m_LastModified, and m_Path.
Referenced by FileWatcher().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 100 of file FileWatcher.h.
Referenced by HasChanged(), IsWatching(), Reset(), and Watch().
|
private |
Definition at line 99 of file FileWatcher.h.
Referenced by HasChanged(), Reset(), and Watch().
|
private |
Definition at line 98 of file FileWatcher.h.
Referenced by GetPath(), HasChanged(), Reset(), and Watch().