TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
efsw.h
Go to the documentation of this file.
1 
28 #ifndef ESFW_H
29 #define ESFW_H
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #if defined(_WIN32)
36  #ifdef EFSW_DYNAMIC
37  // Windows platforms
38  #ifdef EFSW_EXPORTS
39  // From DLL side, we must export
40  #define EFSW_API __declspec(dllexport)
41  #else
42  // From client application side, we must import
43  #define EFSW_API __declspec(dllimport)
44  #endif
45  #else
46  // No specific directive needed for static build
47  #ifndef EFSW_API
48  #define EFSW_API
49  #endif
50  #endif
51 #else
52  #if ( __GNUC__ >= 4 ) && defined( EFSW_EXPORTS )
53  #define EFSW_API __attribute__ ((visibility("default")))
54  #endif
55 
56  // Other platforms don't need to define anything
57  #ifndef EFSW_API
58  #define EFSW_API
59  #endif
60 #endif
61 
63 typedef long efsw_watchid;
64 
66 typedef void* efsw_watcher;
67 
69 {
70  EFSW_ADD = 1,
74 };
75 
77 {
84 };
85 
88  efsw_watcher watcher,
89  efsw_watchid watchid,
90  const char* dir,
91  const char* filename,
92  enum efsw_action action,
93  const char* old_filename,
94  void* param
95 );
96 
101 efsw_watcher EFSW_API efsw_create(int generic_mode);
102 
104 void EFSW_API efsw_release(efsw_watcher watcher);
105 
107 EFSW_API const char* efsw_getlasterror();
108 
112 efsw_watchid EFSW_API efsw_addwatch(efsw_watcher watcher, const char* directory,
113  efsw_pfn_fileaction_callback callback_fn, int recursive, void* param);
114 
116 void EFSW_API efsw_removewatch(efsw_watcher watcher, const char* directory);
117 
119 void EFSW_API efsw_removewatch_byid(efsw_watcher watcher, efsw_watchid watchid);
120 
122 void EFSW_API efsw_watch(efsw_watcher watcher);
123 
128 void EFSW_API efsw_follow_symlinks(efsw_watcher watcher, int enable);
129 
131 int EFSW_API efsw_follow_symlinks_isenabled(efsw_watcher watcher);
132 
142 void EFSW_API efsw_allow_outofscopelinks(efsw_watcher watcher, int allow);
143 
145 int EFSW_API efsw_outofscopelinks_isallowed(efsw_watcher watcher);
146 
147 #ifdef __cplusplus
148 }
149 #endif
150 
151 #endif
void EFSW_API efsw_allow_outofscopelinks(efsw_watcher watcher, int allow)
Definition: FileWatcherCWrapper.cpp:123
Definition: efsw.h:70
EFSW_API const char * efsw_getlasterror()
Retreive last error occured by file-watcher.
Definition: FileWatcherCWrapper.cpp:77
void EFSW_API efsw_removewatch(efsw_watcher watcher, const char *directory)
Remove a directory watch. This is a brute force search O(nlogn).
Definition: FileWatcherCWrapper.cpp:98
void EFSW_API efsw_watch(efsw_watcher watcher)
Starts watching ( in other thread )
Definition: FileWatcherCWrapper.cpp:108
int EFSW_API efsw_follow_symlinks_isenabled(efsw_watcher watcher)
Definition: FileWatcherCWrapper.cpp:118
void EFSW_API efsw_removewatch_byid(efsw_watcher watcher, efsw_watchid watchid)
Remove a directory watch. This is a map lookup O(logn).
Definition: FileWatcherCWrapper.cpp:103
efsw_error
Definition: efsw.h:76
Definition: efsw.h:79
void * efsw_watcher
Type for watcher.
Definition: efsw.h:66
void(* efsw_pfn_fileaction_callback)(efsw_watcher watcher, efsw_watchid watchid, const char *dir, const char *filename, enum efsw_action action, const char *old_filename, void *param)
Basic interface for listening for file events.
Definition: efsw.h:87
Definition: efsw.h:83
Definition: efsw.h:81
int EFSW_API efsw_outofscopelinks_isallowed(efsw_watcher watcher)
Definition: FileWatcherCWrapper.cpp:128
Definition: efsw.h:78
Sent when a file is deleted or renamed.
Definition: efsw.h:72
Definition: efsw.h:80
#define EFSW_API
Definition: efsw.h:58
void EFSW_API efsw_follow_symlinks(efsw_watcher watcher, int enable)
Definition: FileWatcherCWrapper.cpp:113
long efsw_watchid
Type for a watch id.
Definition: efsw.h:63
Sent when a file is created or renamed.
Definition: efsw.h:71
efsw_watcher EFSW_API efsw_create(int generic_mode)
Definition: FileWatcherCWrapper.cpp:66
Sent when a file is modified.
Definition: efsw.h:73
efsw_action
Definition: efsw.h:68
void EFSW_API efsw_release(efsw_watcher watcher)
Release the file-watcher and unwatch any directories.
Definition: FileWatcherCWrapper.cpp:71
efsw_watchid EFSW_API efsw_addwatch(efsw_watcher watcher, const char *directory, efsw_pfn_fileaction_callback callback_fn, int recursive, void *param)
Definition: FileWatcherCWrapper.cpp:84
Definition: efsw.h:82