]> git.lyx.org Git - lyx.git/blobdiff - src/support/FileMonitor.h
Remove non-copyable idioms
[lyx.git] / src / support / FileMonitor.h
index de9e9068e1febee240a000f6c376f21f09055ea4..3f0b91785b3a56917b946b52344781942551d519 100644 (file)
@@ -6,7 +6,7 @@
  *
  * \author Angus Leeming
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  *
  * FileMonitor monitors a file and informs a listener when that file has
  * changed.
 #ifndef FILEMONITOR_H
 #define FILEMONITOR_H
 
-#include "LString.h"
+#include <boost/signal.hpp>
 
-#include <boost/utility.hpp>
-#include <boost/scoped_ptr.hpp>
-#include <boost/signals/signal0.hpp>
+namespace lyx {
+namespace support {
 
-class FileMonitor : boost::noncopyable {
+class FileName;
+
+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;
@@ -51,16 +55,23 @@ public:
        unsigned long checksum() const;
 
        /// Connect and you'll be informed when the file has changed.
-       typedef boost::signal0<void>::slot_type slot_type;
+       typedef boost::signal<void()> 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<Impl> const pimpl_;
+       Impl * const pimpl_;
 };
 
+} // namespace support
+} // namespace lyx
+
 #endif // FILEMONITOR_H