Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 :
10 : #ifndef INCLUDED_SVTOOLS_FILECHANGEDCHECKER_HXX
11 : #define INCLUDED_SVTOOLS_FILECHANGEDCHECKER_HXX
12 :
13 : #include <svtools/svtdllapi.h>
14 : #include <boost/function.hpp>
15 : #include <osl/file.hxx>
16 : #include <vcl/timer.hxx>
17 : #include <vcl/idle.hxx>
18 :
19 : /** Periodically checks if a file has been modified
20 :
21 : Instances of this class setup a vcl timer to occasionally wake up
22 : check whether file modification time has changed.
23 : */
24 0 : class SVT_DLLPUBLIC FileChangedChecker
25 : {
26 : private :
27 : Idle mIdle;
28 : OUString mFileName;
29 : TimeValue mLastModTime;
30 : ::boost::function0<void> mpCallback;
31 :
32 : bool SVT_DLLPRIVATE getCurrentModTime(TimeValue& o_rValue) const;
33 : DECL_LINK_TYPED(TimerHandler, Idle *, void);
34 :
35 : public :
36 : void resetTimer();
37 : bool hasFileChanged();
38 : FileChangedChecker(const OUString& rFilename, const ::boost::function0<void>& rCallback);
39 : };
40 :
41 : #endif
|