LibreOffice Module svtools (master) 1
filechangedchecker.hxx
Go to the documentation of this file.
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#pragma once
11
12#include <svtools/svtdllapi.h>
13
14#include <osl/time.h>
15#include <rtl/ustring.hxx>
16#include <vcl/timer.hxx>
17
18#include <functional>
19
26{
27private:
29 OUString mFileName;
30 TimeValue mLastModTime;
31 ::std::function<void ()> mpCallback;
32
33 bool SVT_DLLPRIVATE getCurrentModTime(TimeValue& o_rValue) const;
34 DECL_DLLPRIVATE_LINK(TimerHandler, Timer *, void);
35
36public:
37 void resetTimer();
38 // bUpdate = true when file has changed, get the return and the object get the new time
39 // = false when file has changed, only get the return, not change the object
40 bool hasFileChanged(bool bUpdate = true);
41 FileChangedChecker(OUString aFilename,
42 ::std::function<void ()> aCallback);
43 // without Timer function
44 FileChangedChecker(OUString aFilename);
45};
Periodically checks if a file has been modified.
DECL_DLLPRIVATE_LINK(TimerHandler, Timer *, void)
::std::function< void()> mpCallback
#define SVT_DLLPUBLIC
Definition: svtdllapi.h:27
#define SVT_DLLPRIVATE
Definition: svtdllapi.h:29