4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
11 * FileMonitor monitors a file and informs a listener when that file has
18 #include <boost/signal.hpp>
28 /** Once monitoring begins, the file will be monitored every
31 * FIXME: rewrite and simplify using an encapsulation of QFileSystemWatcher.
33 FileMonitor(FileName const & file_with_path, int interval);
39 void reset(FileName const & file_with_path) const;
42 FileName const & filename() const;
44 /// Begin monitoring the file
49 bool monitoring() const;
51 /** The checksum is recomputed whenever the file is modified.
52 * If the file is not being monitored, then the checksum will be
53 * recomputed each time this function is called.
55 unsigned long checksum() const;
57 /// Connect and you'll be informed when the file has changed.
58 typedef boost::signal<void()> FileChangedSig;
59 typedef FileChangedSig::slot_type slot_type;
61 boost::signals::connection connect(slot_type const &) const;
65 FileMonitor(FileMonitor const &);
66 void operator=(FileMonitor const &);
68 /// Use the Pimpl idiom to hide the internals.
70 /// The pointer never changes although *pimpl_'s contents may.
74 } // namespace support
77 #endif // FILEMONITOR_H