#include <WatchFile.h>
Public Types | |
enum | Initial { NO_INIT, INIT } |
Public Member Functions | |
WatchFile (const Pathname &path_r=Pathname(), Initial mode=INIT) | |
const Pathname & | path () const |
bool | hasChanged () |
Private Attributes | |
Pathname | _path |
off_t | _size |
time_t | _mtime |
Repeatedly call hasChanged to check whether the content has changed since the last call. Creation or deletion of the file will be reported as change as well.
Per default the ctor stats the file, so hasChanged will detect changes done after WatchFile was created.
You may omit the initial stat by passing NO_INIT
as second argument to the ctor. WatchFile will behave as if the file did not exist at the time WatchFile was created.
static WatchFile sysconfigFile( "/etc/sysconfig/SuSEfirewall2", WatchFile::NO_INIT ); if ( sysconfigFile.hasChanged() ) { // reload the file... }
Definition at line 49 of file WatchFile.h.
zypp::WatchFile::WatchFile | ( | const Pathname & | path_r = Pathname() , |
|
Initial | mode = INIT | |||
) | [inline] |
const Pathname& zypp::WatchFile::path | ( | ) | const [inline] |
bool zypp::WatchFile::hasChanged | ( | ) | [inline] |
Pathname zypp::WatchFile::_path [private] |
off_t zypp::WatchFile::_size [private] |
time_t zypp::WatchFile::_mtime [private] |