]> git.lyx.org Git - lyx.git/blobdiff - src/support/FileMonitor.C
* lyxfunctional.h: delete compare_memfun and helper classes
[lyx.git] / src / support / FileMonitor.C
index 4bc514e581722d607ae324790a3c519eb0a365bf..4a7fa07bf36dda81601d44b9216043f621b7a415 100644 (file)
@@ -1,17 +1,15 @@
-/*
+/**
  * \file FileMonitor.C
- * 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 <leeming@lyx.org>
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include "FileMonitor.h"
 
 #include "frontends/Timeout.h"
 #include <boost/bind.hpp>
 #include <boost/signals/trackable.hpp>
 
+
+using std::string;
+
+
+namespace lyx {
+namespace support {
+
 struct FileMonitor::Impl : public boost::signals::trackable {
 
        ///
@@ -37,7 +42,7 @@ struct FileMonitor::Impl : public boost::signals::trackable {
        Timeout timer_;
 
        /// This signal is emitted if the file is modified (has a new checksum).
-       boost::signal0<void> fileChanged_;
+       FileMonitor::FileChangedSig fileChanged_;
 
        /** We use these to ascertain whether a file (once loaded successfully)
         *  has changed.
@@ -65,7 +70,7 @@ void FileMonitor::reset(string const & file_with_path) const
        bool const monitor = pimpl_->timer_.running();
        if (monitor)
                stop();
-       
+
        pimpl_->filename_ = file_with_path;
 
        if (monitor)
@@ -89,7 +94,7 @@ void FileMonitor::start() const
                return;
 
        pimpl_->timestamp_ = finfo.getModificationTime();
-       pimpl_->checksum_ = lyx::sum(pimpl_->filename_);
+       pimpl_->checksum_ = sum(pimpl_->filename_);
 
        if (pimpl_->timestamp_ && pimpl_->checksum_) {
                pimpl_->timer_.start();
@@ -119,7 +124,7 @@ unsigned long FileMonitor::checksum() const
        // If we aren't actively monitoring the file, then recompute the
        // checksum explicitly.
        if (!pimpl_->timer_.running() && !pimpl_->filename_.empty())
-               return lyx::sum(pimpl_->filename_);
+               return sum(pimpl_->filename_);
 
        return pimpl_->checksum_;
 }
@@ -162,7 +167,7 @@ void FileMonitor::Impl::monitorFile()
                if (new_timestamp != timestamp_) {
                        timestamp_ = new_timestamp;
 
-                       unsigned long const new_checksum = lyx::sum(filename_);
+                       unsigned long const new_checksum = sum(filename_);
                        if (new_checksum != checksum_) {
                                checksum_ = new_checksum;
                                changed = true;
@@ -174,3 +179,6 @@ void FileMonitor::Impl::monitorFile()
        if (changed)
                fileChanged_();
 }
+
+} // namespace support
+} // namespace lyx