ICF 3.1.1.10
Technical documentation of ICF Libraries
CConsoleReader.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9// Qt includes
10#include <QtCore/QThread>
11
12
13namespace ibase
14{
15
16
20class CConsoleReader: public QObject
21{
22 Q_OBJECT
23
24public:
25 typedef QObject BaseClass;
26
27 explicit CConsoleReader(QObject* parentPtr = nullptr);
28
32 virtual void Start();
33
37 virtual void Stop();
38
42 bool IsRunning() const;
43
44signals:
48 void KeyPressedSignal(char character);
49
50protected:
51 class InputObserver: public QThread
52 {
53 public:
54 explicit InputObserver(CConsoleReader& parent);
55
56 void Stop();
57
58 protected:
59 // reimplemented (QThread)
60 virtual void run();
61
62 private:
63 CConsoleReader& m_parent;
64 bool m_shouldBeFinished;
65 };
66
67private:
68 InputObserver m_inputObserver;
69};
70
71
72} // namespace ibase
73
74
InputObserver(CConsoleReader &parent)
User-input reader for command line console.
bool IsRunning() const
Check if the reader is running.
CConsoleReader(QObject *parentPtr=nullptr)
void KeyPressedSignal(char character)
Emit typed character.
virtual void Start()
Start reading of the user input on the console.
virtual void Stop()
Stop reading of the user input on the console.
This namespace contains standard classes based on Qt.

© Witold Gantzke and Kirill Lepskiy