// =============================================================== //
//                                                                 //
//   File      : aw_inotify.hxx                                    //
//   Purpose   : watch file/directory changes                      //
//                                                                 //
//   Coded by Ralf Westram (coder@reallysoft.de) in October 2017   //
//   http://www.arb-home.de/                                       //
//                                                                 //
// =============================================================== //

#ifndef AW_INOTIFY_HXX
#define AW_INOTIFY_HXX

#ifndef CB_H
#include <cb.h>
#endif

enum ChangeReason {
    CR_MODIFIED,
    CR_DELETED, // will be suppressed if the file still exists
    CR_CREATED,
};

#define CHANGE_REASONS (CR_CREATED+1)

DECLARE_CBTYPE_FFV_AND_BUILDERS(FileChangedCallback, void, const char*, ChangeReason);   // generates makeFileChangedCallback

void AW_add_inotification(const char *file, const FileChangedCallback& fccb);
void AW_remove_inotification(const char *file, const FileChangedCallback& fccb);


#else
#error aw_inotify.hxx included twice
#endif // AW_INOTIFY_HXX
