OpenStudioCore:utilities
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Slots | Public Member Functions | List of all members
openstudio::PathWatcher Class Reference

#include <PathWatcher.hpp>

+ Inheritance diagram for openstudio::PathWatcher:

Public Slots

void checkFile ()
 periodically check for changes More...
 
void directoryChanged (const QString &path)
 called when file/directory is added or removed or when directory is removed More...
 
void fileChanged (const QString &path)
 called when file is modified or removed More...
 

Public Member Functions

void clearState ()
 reset state to clean More...
 
bool dirty () const
 true if path has been changed More...
 
bool disable ()
 
void enable ()
 enable the watcher More...
 
bool enabled () const
 is the watcher currently enabled More...
 
virtual void onPathAdded ()
 for files, called when watched file is added if watcher enabled More...
 
virtual void onPathChanged ()
 for files, called when watched file is modified if watcher enabled for directories, called when file/directory is added or removed to the watched directory if watcher enabled More...
 
virtual void onPathRemoved ()
 for files, called when watched file is removed if watcher enabled for directories, called when the watched directory is removed if watcher enabled More...
 
openstudio::path path () const
 path that is being watched More...
 
 PathWatcher (const openstudio::path &p, int msec=1000)
 constructor with path More...
 
virtual ~PathWatcher ()
 virtual destructor More...
 

Detailed Description

Class for watching either a file or directory, QFileSystemWatcher has issues when watching many files so it is not recommended to use too many of these objects.

Constructor & Destructor Documentation

openstudio::PathWatcher::PathWatcher ( const openstudio::path &  p,
int  msec = 1000 
)

constructor with path

if path is a directory it must exist at time of construction, no periodic checks are performed for directory if path is not a directory it is assumed to be a regular file which may or may not exist at construction, a timer is used to periodically check for changes to the file msec is the timer delay to check for updates to the file, msec does not apply if the path is a directory

virtual openstudio::PathWatcher::~PathWatcher ( )
virtual

virtual destructor

Member Function Documentation

void openstudio::PathWatcher::checkFile ( )
slot

periodically check for changes

void openstudio::PathWatcher::clearState ( )

reset state to clean

void openstudio::PathWatcher::directoryChanged ( const QString &  path)
slot

called when file/directory is added or removed or when directory is removed

bool openstudio::PathWatcher::dirty ( ) const

true if path has been changed

bool openstudio::PathWatcher::disable ( )
void openstudio::PathWatcher::enable ( )

enable the watcher

bool openstudio::PathWatcher::enabled ( ) const

is the watcher currently enabled

void openstudio::PathWatcher::fileChanged ( const QString &  path)
slot

called when file is modified or removed

virtual void openstudio::PathWatcher::onPathAdded ( )
virtual

for files, called when watched file is added if watcher enabled

virtual void openstudio::PathWatcher::onPathChanged ( )
virtual

for files, called when watched file is modified if watcher enabled for directories, called when file/directory is added or removed to the watched directory if watcher enabled

virtual void openstudio::PathWatcher::onPathRemoved ( )
virtual

for files, called when watched file is removed if watcher enabled for directories, called when the watched directory is removed if watcher enabled

openstudio::path openstudio::PathWatcher::path ( ) const

path that is being watched