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 FileMonitor(FileName const & file_with_path, int interval);
37 void reset(FileName const & file_with_path) const;
40 FileName const & filename() const;
42 /// Begin monitoring the file
47 bool monitoring() const;
49 /** The checksum is recomputed whenever the file is modified.
50 * If the file is not being monitored, then the checksum will be
51 * recomputed each time this function is called.
53 unsigned long checksum() const;
55 /// Connect and you'll be informed when the file has changed.
56 typedef boost::signal<void()> FileChangedSig;
57 typedef FileChangedSig::slot_type slot_type;
59 boost::signals::connection connect(slot_type const &) const;
63 FileMonitor(FileMonitor const &);
64 void operator=(FileMonitor const &);
66 /// Use the Pimpl idiom to hide the internals.
68 /// The pointer never changes although *pimpl_'s contents may.
72 } // namespace support
75 #endif // FILEMONITOR_H