1 /****************************************************************************
2 **
3 ** DQt - D bindings for the Qt Toolkit
4 **
5 ** GNU Lesser General Public License Usage
6 ** This file may be used under the terms of the GNU Lesser
7 ** General Public License version 3 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
9 ** packaging of this file. Please review the following information to
10 ** ensure the GNU Lesser General Public License version 3 requirements
11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
12 **
13 ****************************************************************************/
14 module qt.core.basictimer;
15 extern(C++):
16 
17 import qt.config;
18 import qt.core.namespace;
19 import qt.core.object;
20 import qt.core.typeinfo;
21 import qt.helpers;
22 
23 /+ class QObject; +/
24 
25 @Q_MOVABLE_TYPE extern(C++, class) struct /+ Q_CORE_EXPORT +/ QBasicTimer
26 {
27 private:
28     int id;
29 /+ #if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
30     Q_DISABLE_COPY(QBasicTimer)
31 #elif QT_DEPRECATED_SINCE(5, 14) +/
32 public:
33     // Just here to preserve BC, we can't remove them yet
34     @disable this(this);
35     /+ QT_DEPRECATED_X("copy-construction is unsupported; use move-construction instead") +/this(ref const(QBasicTimer) );
36     /+/+ QT_DEPRECATED_X("copy-assignment is unsupported; use move-assignment instead") +/
37         ref QBasicTimer operator =(ref const(QBasicTimer) );+/
38 /+ #endif +/
39 
40 public:
41     @disable this();
42     /+/+ constexpr +/this()/+ noexcept+/
43     {
44         this.id = {0};
45     }+/
46     pragma(inline, true) ~this() { if (id) stop(); }
47 
48     /+ QBasicTimer(QBasicTimer &&other) noexcept
49         : id{qExchange(other.id, 0)}
50     {} +/
51 
52     /+ QBasicTimer& operator=(QBasicTimer &&other) noexcept
53     {
54         QBasicTimer{std::move(other)}.swap(*this);
55         return *this;
56     } +/
57 
58     /+ void swap(QBasicTimer &other) noexcept { qSwap(id, other.id); } +/
59 
60     bool isActive() const/+ noexcept+/ { return id != 0; }
61     int timerId() const/+ noexcept+/ { return id; }
62 
63     void start(int msec, QObject obj);
64     void start(int msec, /+ Qt:: +/qt.core.namespace.TimerType timerType, QObject obj);
65     void stop();
66 }
67 /+ Q_DECLARE_TYPEINFO(QBasicTimer, Q_MOVABLE_TYPE);
68 
69 inline void swap(QBasicTimer &lhs, QBasicTimer &rhs) noexcept { lhs.swap(rhs); } +/
70