1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/unix/private/fswatcher_kqueue.h
3 // Purpose: File system watcher impl classes
4 // Author: Bartosz Bekier
6 // Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com>
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef WX_UNIX_PRIVATE_FSWATCHER_KQUEUE_H_
11 #define WX_UNIX_PRIVATE_FSWATCHER_KQUEUE_H_
17 #include "wx/arrstr.h"
19 // ============================================================================
20 // wxFSWatcherEntry implementation & helper declarations
21 // ============================================================================
23 class wxFSWatcherImplKqueue
;
25 class wxFSWatchEntryKq
: public wxFSWatchInfo
30 wxDirState(const wxFSWatchInfo
& winfo
)
32 if (!wxDir::Exists(winfo
.GetPath()))
35 wxDir
dir(winfo
.GetPath());
36 wxCHECK_RET( dir
.IsOpened(),
37 wxString::Format("Unable to open dir '%s'", winfo
.GetPath()));
40 bool ret
= dir
.GetFirst(&filename
);
43 files
.push_back(filename
);
44 ret
= dir
.GetNext(&filename
);
48 wxSortedArrayString files
;
51 wxFSWatchEntryKq(const wxFSWatchInfo
& winfo
) :
52 wxFSWatchInfo(winfo
), m_lastState(winfo
)
54 m_fd
= wxOpen(m_path
, O_RDONLY
, 0);
57 wxLogSysError(_("Unable to open path '%s'"), m_path
);
61 virtual ~wxFSWatchEntryKq()
71 int ret
= close(m_fd
);
74 wxLogSysError(_("Unable to close path '%s'"), m_path
);
86 int GetFileDescriptor() const
93 m_lastState
= wxDirState(*this);
96 const wxDirState
& GetLastState() const
103 wxDirState m_lastState
;
105 wxDECLARE_NO_COPY_CLASS(wxFSWatchEntryKq
);
108 #endif /* WX_UNIX_PRIVATE_FSWATCHER_KQUEUE_H_ */