Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cFileChangeWatch Class Reference

#include <cFileChangeWatch.h>

Public Member Functions

 cFileChangeWatch ()
 
virtual ~cFileChangeWatch ()
 
bool isValidFileChangeWatch () const noexcept
 
void removeAllFileChangeWatches ()
 
bool hasFileChangeWatch (const FILECHAR_t *pszDir) const
 
HRESULT addFileChangeWatch (const FILECHAR_t *pszDir, FILE_CHANGE_TYPE eType)
 
HRESULT removeFileChangeWatch (const FILECHAR_t *pszDir)
 
HRESULT waitForFileChanges (TIMESYSD_t nWaitDelay=0, OUT cArraySortString< FILECHAR_t > *pChangeList=nullptr)
 
 UNITTEST_FRIEND (cFileChangeWatch)
 

Protected Member Functions

virtual cRefPtr< cFileChangeElemcreateFileChangeWatch (cStringF sDir, FILE_CHANGE_TYPE eType, HANDLE hFileChange)
 

Protected Attributes

cArraySortName< cFileChangeElemm_aWatches
 FindFirstChangeNotification. can use WaitForMultipleObjects() etc on this. More...
 

Detailed Description

Get notifications that some element of a directory has changed in some way. look for local external file changes by calling waitForFileChanges() http://www.linuxjournal.com/article/8478 Similar to .NET FileSystemWatcher, inotify,

Constructor & Destructor Documentation

◆ cFileChangeWatch()

GrayLib::cFileChangeWatch::cFileChangeWatch ( )

◆ ~cFileChangeWatch()

GrayLib::cFileChangeWatch::~cFileChangeWatch ( void  )
virtual

Member Function Documentation

◆ addFileChangeWatch()

HRESULT GrayLib::cFileChangeWatch::addFileChangeWatch ( const FILECHAR_t pszDir,
FILE_CHANGE_TYPE  eType 
)

Add a file or directory to the list of objects i am watching. directory can be recursive.

◆ createFileChangeWatch()

cRefPtr< cFileChangeElem > GrayLib::cFileChangeWatch::createFileChangeWatch ( cStringF  sDir,
FILE_CHANGE_TYPE  eType,
HANDLE  hFileChange 
)
protectedvirtual

Override this to add a new thing to watch. Called form addFileChangeWatch

◆ hasFileChangeWatch()

bool GrayLib::cFileChangeWatch::hasFileChangeWatch ( const FILECHAR_t pszDir) const

◆ isValidFileChangeWatch()

bool GrayLib::cFileChangeWatch::isValidFileChangeWatch ( ) const
inlinenoexcept

any files being watched?

◆ removeAllFileChangeWatches()

void GrayLib::cFileChangeWatch::removeAllFileChangeWatches ( )

◆ removeFileChangeWatch()

HRESULT GrayLib::cFileChangeWatch::removeFileChangeWatch ( const FILECHAR_t pszDir)

remove a file from the watch list.

Returns
number of children also removed for FILE_CHANGE_RECURSIVE

◆ UNITTEST_FRIEND()

GrayLib::cFileChangeWatch::UNITTEST_FRIEND ( cFileChangeWatch  )

◆ waitForFileChanges()

HRESULT GrayLib::cFileChangeWatch::waitForFileChanges ( TIMESYSD_t  nWaitDelay = 0,
OUT cArraySortString< FILECHAR_t > *  pChangeList = nullptr 
)

report any changes to the file/dir(s) being watched.

  • nWaitDelay = mSec wait for changes. pChangeList = return list of full paths to things that changed. nullptr = don't care.
    Returns
    Number of changes to files since last call. <0 = error HRESULT_WIN32_C(ERROR_BUFFER_OVERFLOW) = too many changes to list.

Member Data Documentation

◆ m_aWatches

cArraySortName<cFileChangeElem> GrayLib::cFileChangeWatch::m_aWatches
protected

FindFirstChangeNotification. can use WaitForMultipleObjects() etc on this.


The documentation for this class was generated from the following files: