1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/unix/private/fswatcher_kqueue.h
3 // Purpose: File system watcher impl classes
4 // Author: Bartosz Bekier
7 // Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com>
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef WX_UNIX_PRIVATE_FSWATCHER_KQUEUE_H_
12 #define WX_UNIX_PRIVATE_FSWATCHER_KQUEUE_H_
18 #include "wx/arrstr.h"
20 // ============================================================================
21 // wxFSWatcherEntry implementation & helper declarations
22 // ============================================================================
24 class wxFSWatcherImplKqueue
;
26 class wxFSWatchEntryKq
: public wxFSWatchInfo
31 wxDirState(const wxFSWatchInfo
& winfo
)
33 if (!wxDir::Exists(winfo
.GetPath()))
36 wxDir
dir(winfo
.GetPath());
37 wxCHECK_RET( dir
.IsOpened(),
38 wxString::Format("Unable to open dir '%s'", winfo
.GetPath()));
41 bool ret
= dir
.GetFirst(&filename
);
44 files
.push_back(filename
);
45 ret
= dir
.GetNext(&filename
);
49 wxSortedArrayString files
;
52 wxFSWatchEntryKq(const wxFSWatchInfo
& winfo
) :
53 wxFSWatchInfo(winfo
), m_lastState(winfo
)
55 m_fd
= wxOpen(m_path
, O_RDONLY
, 0);
58 wxLogSysError(_("Unable to open path '%s'"), m_path
);
62 virtual ~wxFSWatchEntryKq()
72 int ret
= close(m_fd
);
75 wxLogSysError(_("Unable to close path '%s'"), m_path
);
87 int GetFileDescriptor() const
94 m_lastState
= wxDirState(*this);
97 const wxDirState
& GetLastState() const
104 wxDirState m_lastState
;
106 wxDECLARE_NO_COPY_CLASS(wxFSWatchEntryKq
);
109 #endif /* WX_UNIX_PRIVATE_FSWATCHER_KQUEUE_H_ */