Qx v0.6
Qt Extensions Library
Loading...
Searching...
No Matches
qx-systemsignalwatcher.h
1#ifndef QX_SYSTEMSIGNALWATCHER_H
2#define QX_SYSTEMSIGNALWATCHER_H
3
4// Shared Lib Support
5#include "qx/core/qx_core_export.h"
6
7// Qt Includes
8#include <QObject>
9
10namespace Qx
11{
12
13class SystemSignalWatcherPrivate;
14
15class QX_CORE_EXPORT SystemSignalWatcher : public QObject
16{
17 Q_OBJECT;
18 Q_DECLARE_PRIVATE(SystemSignalWatcher);
19
20//-Class Enums-------------------------------------------------------------------------------------------------
21public:
22 /* For now we only support signals that can be mapped cross-platform. In the future we could support more
23 * with a doc note that the additional signals will never be received outside of Linux
24 */
25 enum Signal
26 {
27 None = 0x0,
28 Interrupt = 0x1,
29 HangUp = 0x2,
30 Quit = 0x4,
31 Terminate = 0x8,
32 Abort = 0x10,
33 };
34 Q_DECLARE_FLAGS(Signals, Signal);
35
36
37//-Instance Variables-------------------------------------------------------------------------------------------------
38private:
39 std::unique_ptr<SystemSignalWatcherPrivate> d_ptr;
40
41//-Constructor-------------------------------------------------------------------------------------------------
42public:
44
45//-Destructor-------------------------------------------------------------------------------------------------
46public:
47 ~SystemSignalWatcher(); // Required for d_ptr destructor to compile
48
49//-Instance Functions--------------------------------------------------------------------------------------------
50public:
51 void watch(Signals s);
52 void stop();
53 void yield();
54
55 Signals watching() const;
56 bool isWatching() const;
57 bool isRegistered() const;
58
59//-Signals & Slots------------------------------------------------------------------------------------------------
60signals:
61 void signaled(Signal s, bool* handled);
62};
63Q_DECLARE_OPERATORS_FOR_FLAGS(SystemSignalWatcher::Signals);
64
65}
66
67#endif // QX_SYSTEMSIGNALWATCHER_H
The SystemSignalWatcher class provides a convenient and comprehensive way to react to system defined ...
Definition qx-systemsignalwatcher.h:16
Signal
Definition qx-systemsignalwatcher.h:26
void signaled(Signal s, bool *handled)
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-abstracterror.cpp:13