]> git.saurik.com Git - wxWidgets.git/blob - include/wx/unix/private/fswatcher_inotify.h
249450eb509cb3dde2537ec84fc8f9c520aa3271
[wxWidgets.git] / include / wx / unix / private / fswatcher_inotify.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/unix/private/fswatcher_inotify.h
3 // Purpose: File system watcher impl classes
4 // Author: Bartosz Bekier
5 // Created: 2009-05-26
6 // Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com>
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef WX_UNIX_PRIVATE_FSWATCHER_INOTIFY_H_
11 #define WX_UNIX_PRIVATE_FSWATCHER_INOTIFY_H_
12
13 #include "wx/filename.h"
14 #include "wx/evtloopsrc.h"
15
16 // ============================================================================
17 // wxFSWatcherEntry implementation & helper declarations
18 // ============================================================================
19
20 class wxFSWatcherImplUNIX;
21
22 class wxFSWatchEntry : public wxFSWatchInfo
23 {
24 public:
25 wxFSWatchEntry(const wxFSWatchInfo& winfo) :
26 wxFSWatchInfo(winfo)
27 {
28 }
29
30 int GetWatchDescriptor() const
31 {
32 return m_wd;
33 }
34
35 void SetWatchDescriptor(int wd)
36 {
37 m_wd = wd;
38 }
39
40 private:
41 int m_wd;
42
43 wxDECLARE_NO_COPY_CLASS(wxFSWatchEntry);
44 };
45
46
47 // ============================================================================
48 // wxFSWSourceHandler helper class
49 // ============================================================================
50
51 class wxFSWatcherImplUnix;
52
53 /**
54 * Handler for handling i/o from inotify descriptor
55 */
56 class wxFSWSourceHandler : public wxEventLoopSourceHandler
57 {
58 public:
59 wxFSWSourceHandler(wxFSWatcherImplUnix* service) :
60 m_service(service)
61 { }
62
63 virtual void OnReadWaiting();
64 virtual void OnWriteWaiting();
65 virtual void OnExceptionWaiting();
66
67 protected:
68 wxFSWatcherImplUnix* m_service;
69 };
70
71 #endif /* WX_UNIX_PRIVATE_FSWATCHER_INOTIFY_H_ */