X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2FFileMonitor.h;h=3f0b91785b3a56917b946b52344781942551d519;hb=0a9735c5f7bbbaa24ac2e3e4fa745c6dfbc95a18;hp=f91e3f2541d567e33e65c78501b2afdead641128;hpb=6206e59009739d747b3569a21a33652b53977589;p=lyx.git diff --git a/src/support/FileMonitor.h b/src/support/FileMonitor.h index f91e3f2541..3f0b91785b 100644 --- a/src/support/FileMonitor.h +++ b/src/support/FileMonitor.h @@ -1,10 +1,12 @@ // -*- C++ -*- -/* +/** * \file FileMonitor.h - * Copyright 2002 the LyX Team - * Read the file COPYING + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * \author Angus Leeming + * \author Angus Leeming + * + * Full author contact details are available in file CREDITS. * * FileMonitor monitors a file and informs a listener when that file has * changed. @@ -13,31 +15,31 @@ #ifndef FILEMONITOR_H #define FILEMONITOR_H -#ifdef __GNUG__ -#pragma interface -#endif +#include -#include "LString.h" +namespace lyx { +namespace support { -#include -#include -#include +class FileName; -class FileMonitor : boost::noncopyable { +class FileMonitor +{ public: /** Once monitoring begins, the file will be monitored every * interval ms. + * + * FIXME: rewrite and simplify using an encapsulation of QFileSystemWatcher. */ - FileMonitor(string const & file_with_path, int interval); + FileMonitor(FileName const & file_with_path, int interval); - /// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy. + /// Destructor ~FileMonitor(); /// - void reset(string const & file_with_path) const; + void reset(FileName const & file_with_path) const; /// - string const & filename() const; + FileName const & filename() const; /// Begin monitoring the file void start() const; @@ -53,16 +55,23 @@ public: unsigned long checksum() const; /// Connect and you'll be informed when the file has changed. - typedef boost::signal0::slot_type slot_type; + typedef boost::signal FileChangedSig; + typedef FileChangedSig::slot_type slot_type; /// boost::signals::connection connect(slot_type const &) const; private: + /// noncopyable + FileMonitor(FileMonitor const &); + void operator=(FileMonitor const &); + /// Use the Pimpl idiom to hide the internals. class Impl; - /// The pointer never changes although *pimpl_'s contents may. - boost::scoped_ptr const pimpl_; + Impl * const pimpl_; }; +} // namespace support +} // namespace lyx + #endif // FILEMONITOR_H