summaryrefslogtreecommitdiff
path: root/include/svtools/filechangedchecker.hxx
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2013-04-18 18:26:28 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2013-04-23 22:20:31 +0200
commitb9337e22ce1dbf2eba0e8c8db294ae99f4111f91 (patch)
tree53ee1bd3dfd213815a21579151983cb997922b05 /include/svtools/filechangedchecker.hxx
parentf4e1642a1761d5eab6ccdd89928869c2b2f1528a (diff)
execute move of global headers
see https://gerrit.libreoffice.org/#/c/3367/ and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a
Diffstat (limited to 'include/svtools/filechangedchecker.hxx')
-rw-r--r--include/svtools/filechangedchecker.hxx54
1 files changed, 54 insertions, 0 deletions
diff --git a/include/svtools/filechangedchecker.hxx b/include/svtools/filechangedchecker.hxx
new file mode 100644
index 000000000000..2b8caa9d2da5
--- /dev/null
+++ b/include/svtools/filechangedchecker.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * [ Surendran Mahendran <surenspost@gmail.com>]
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#ifndef SVTOOLS_INCLUDED_FILECHANGEDCHECKER_HXX
+#define SVTOOLS_INCLUDED_FILECHANGEDCHECKER_HXX
+
+#include "svtools/svtdllapi.h"
+#include <boost/function.hpp>
+#include <osl/file.hxx>
+#include <vcl/timer.hxx>
+
+/** Periodically checks if a file has been modified
+
+ Instances of this class setup a vcl timer to occasionally wake up
+ check whether file modification time has changed.
+ */
+class SVT_DLLPUBLIC FileChangedChecker
+{
+private :
+ Timer mTimer;
+ OUString mFileName;
+ TimeValue mLastModTime;
+ ::boost::function0<void> mpCallback;
+
+ bool SVT_DLLPRIVATE getCurrentModTime(TimeValue& o_rValue) const;
+ DECL_LINK(TimerHandler, void *);
+
+public :
+ void resetTimer();
+ bool hasFileChanged();
+ FileChangedChecker(const OUString& rFilename, const ::boost::function0<void>& rCallback);
+};
+
+#endif