AusweisApp2
 Alle Klassen Namensbereiche Dateien Funktionen Variablen Typdefinitionen Aufzählungen Aufzählungswerte Propertys Freundbeziehungen Makrodefinitionen
ConsoleReader.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
9 #include <QObject>
10 #include <QScopedPointer>
11 
12 #if defined(Q_OS_WIN)
13 #include <Winsock2.h>
14 
15 #include <QThread>
16 #include <Windows.h>
17 #else
18 #include <QSocketNotifier>
19 #endif
20 
21 
22 namespace governikus
23 {
24 
25 #if defined(Q_OS_WIN)
26 
27 class ConsoleInputThread
28  : public QThread
29 {
30  Q_OBJECT
31 
32  public:
33  void run() Q_DECL_OVERRIDE;
34  virtual ~ConsoleInputThread();
35 
36  Q_SIGNALS:
37  void fireText(const QString& pData);
38 };
39 
40 #endif
41 
42 
44  : public QObject
45 {
46  Q_OBJECT
47 
48  private:
49 #if defined(Q_OS_WIN)
50  QScopedPointer<ConsoleInputThread> mConsoleInputThread;
51 #else
52  QScopedPointer<QSocketNotifier> mNotifier;
53 
54  bool mInputOpen;
55 
56  private Q_SLOTS:
57  void onData();
58 #endif
59 
60  public:
61  ConsoleReader(QObject* pParent = nullptr);
62  void init();
63  void shutdown();
64  bool isInputOpen() const;
65 
66  QString readText();
67 
68  Q_SIGNALS:
69  void fireShutdown();
70  void fireText(const QString& pData);
71 };
72 
73 
74 } /* namespace governikus */
Definition: ConsoleReader.h:43