]>
Commit | Line | Data |
---|---|---|
6b8ef0b3 VZ |
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 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com> | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef WX_UNIX_PRIVATE_FSWATCHER_INOTIFY_H_ | |
12 | #define WX_UNIX_PRIVATE_FSWATCHER_INOTIFY_H_ | |
13 | ||
14 | #include "wx/filename.h" | |
5cd99866 | 15 | #include "wx/evtloopsrc.h" |
6b8ef0b3 VZ |
16 | |
17 | // ============================================================================ | |
18 | // wxFSWatcherEntry implementation & helper declarations | |
19 | // ============================================================================ | |
20 | ||
21 | class wxFSWatcherImplUNIX; | |
22 | ||
23 | class wxFSWatchEntry : public wxFSWatchInfo | |
24 | { | |
25 | public: | |
26 | wxFSWatchEntry(const wxFSWatchInfo& winfo) : | |
27 | wxFSWatchInfo(winfo) | |
28 | { | |
29 | } | |
30 | ||
31 | int GetWatchDescriptor() const | |
32 | { | |
33 | return m_wd; | |
34 | } | |
35 | ||
36 | void SetWatchDescriptor(int wd) | |
37 | { | |
38 | m_wd = wd; | |
39 | } | |
40 | ||
41 | private: | |
42 | int m_wd; | |
43 | ||
44 | wxDECLARE_NO_COPY_CLASS(wxFSWatchEntry); | |
45 | }; | |
46 | ||
47 | ||
48 | // ============================================================================ | |
49 | // wxFSWSourceHandler helper class | |
50 | // ============================================================================ | |
51 | ||
52 | class wxFSWatcherImplUnix; | |
53 | ||
54 | /** | |
55 | * Handler for handling i/o from inotify descriptor | |
56 | */ | |
57 | class wxFSWSourceHandler : public wxEventLoopSourceHandler | |
58 | { | |
59 | public: | |
60 | wxFSWSourceHandler(wxFSWatcherImplUnix* service) : | |
61 | m_service(service) | |
62 | { } | |
63 | ||
64 | virtual void OnReadWaiting(); | |
65 | virtual void OnWriteWaiting(); | |
66 | virtual void OnExceptionWaiting(); | |
67 | ||
68 | protected: | |
69 | wxFSWatcherImplUnix* m_service; | |
70 | }; | |
71 | ||
72 | #endif /* WX_UNIX_PRIVATE_FSWATCHER_INOTIFY_H_ */ |