OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / tools / valgrindfake / outputgenerator.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
8 **
9 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 **
11 **
12 ** GNU Lesser General Public License Usage
13 **
14 ** This file may be used under the terms of the GNU Lesser General Public
15 ** License version 2.1 as published by the Free Software Foundation and
16 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
17 ** Please review the following information to ensure the GNU Lesser General
18 ** Public License version 2.1 requirements will be met:
19 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
20 **
21 ** In addition, as a special exception, Nokia gives you certain additional
22 ** rights. These rights are described in the Nokia Qt LGPL Exception
23 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
24 **
25 ** Other Usage
26 **
27 ** Alternatively, this file may be used in accordance with the terms and
28 ** conditions contained in a signed written agreement between you and Nokia.
29 **
30 ** If you have questions regarding the use of this file, please contact
31 ** Nokia at qt-info@nokia.com.
32 **
33 **************************************************************************/
34
35 #ifndef LIBVALGRIND_FAKE_OUTPUTGENERATOR_H
36 #define LIBVALGRIND_FAKE_OUTPUTGENERATOR_H
37
38 #include <QObject>
39 #include <QTimer>
40 #include <QTextStream>
41
42
43 QT_BEGIN_NAMESPACE
44 class QAbstractSocket;
45 class QIODevice;
46 QT_END_NAMESPACE
47
48 namespace Valgrind {
49 namespace Fake {
50
51 class OutputGenerator : public QObject
52 {
53     Q_OBJECT
54
55 public:
56     explicit OutputGenerator(QAbstractSocket *output, QIODevice *input);
57
58     void setCrashRandomly(bool enable);
59     void setOutputGarbage(bool enable);
60     void setWait(uint seconds);
61
62 Q_SIGNALS:
63     void finished();
64 private slots:
65     /// write output to the stream until the next error
66     void writeOutput();
67
68 private:
69     void produceRuntimeError();
70
71     QAbstractSocket *m_output;
72     QIODevice *m_input;
73     QTimer m_timer;
74     bool m_finished;
75     bool m_crash;
76     bool m_garbage;
77     uint m_wait;
78 };
79
80 } // namespace Fake
81 } // namespace Valgrind
82
83 #endif // LIBVALGRIND_FAKE_OUTPUTGENERATOR_H