Unity 8
 All Classes Functions Properties
TimeSource.h
1 /*
2  * Copyright (C) 2013 - Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License, as
6  * published by the Free Software Foundation; either version 2.1 or 3.0
7  * of the License.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranties of
11  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
12  * PURPOSE. See the applicable version of the GNU Lesser General Public
13  * License for more details.
14  *
15  * You should have received a copy of both the GNU Lesser General Public
16  * License along with this program. If not, see <http://www.gnu.org/licenses/>
17  *
18  * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
19  */
20 
21 #ifndef UBUNTUGESTURES_TIMESOURCE_H
22 #define UBUNTUGESTURES_TIMESOURCE_H
23 
24 #include "UbuntuGesturesGlobal.h"
25 #include <QSharedPointer>
26 
27 namespace UbuntuGestures {
28 /*
29  Interface for a time source.
30  */
31 class UBUNTUGESTURES_EXPORT TimeSource {
32 public:
33  virtual ~TimeSource() {}
34  /* Returns the current time in milliseconds since some reference time in the past. */
35  virtual qint64 msecsSinceReference() = 0;
36 };
37 typedef QSharedPointer<TimeSource> SharedTimeSource;
38 
39 /*
40  Implementation of a time source
41  */
42 class RealTimeSourcePrivate;
43 class RealTimeSource : public TimeSource {
44 public:
45  RealTimeSource();
46  virtual ~RealTimeSource();
47  qint64 msecsSinceReference() override;
48 private:
49  RealTimeSourcePrivate *d;
50 };
51 
52 } // namespace UbuntuGestures
53 
54 #endif // UBUNTUGESTURES_TIMESOURCE_H