Debian Codegraph @

src/LomiriGestures/timesource_p.h

raw symbols SCIP
1 /*
2 * Copyright 2015 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Daniel d'Andrada <[email protected]>
17 */
18
19 #ifndef TIMESOURCE_P_H
20 #define TIMESOURCE_P_H
21
22 #include <QtCore/QSharedPointer>
23
24 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
25 #include <LomiriGestures-Qt6/lomirigesturesglobal.h>
26 #else
27 #include <LomiriGestures/lomirigesturesglobal.h>
28 #endif
29
30 UG_NAMESPACE_BEGIN
31 /*
32 Interface for a time source.
33 */
34 class LOMIRIGESTURES_EXPORT TimeSource {
35 public:
36 virtual ~TimeSource() {}
37 /* Returns the current time in milliseconds since some reference time in the past. */
38 virtual qint64 msecsSinceReference() = 0;
39 };
40 typedef QSharedPointer<TimeSource> SharedTimeSource;
41
42 /*
43 Implementation of a time source
44 */
45 class RealTimeSourcePrivate;
46 class LOMIRIGESTURES_EXPORT RealTimeSource : public TimeSource {
47 public:
48 RealTimeSource();
49 virtual ~RealTimeSource();
50 qint64 msecsSinceReference() override;
51 private:
52 RealTimeSourcePrivate *d;
53 };
54
55 /*
56 A fake time source, useful for tests
57 */
58 class FakeTimeSource : public TimeSource {
59 public:
60 FakeTimeSource() { m_msecsSinceReference = 0; }
61 qint64 msecsSinceReference() override { return m_msecsSinceReference; }
62 qint64 m_msecsSinceReference;
63 };
64
65 UG_NAMESPACE_END
66
67 #endif // TIMESOURCE_P_H