OSDN Git Service

0cbc59cb3f0b2876c14506a97b02ddece7d2e729
[qt-creator-jp/qt-creator-jp.git] / src / libs / valgrind / xmlprotocol / threadedparser.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: Andreas Hartmetz, KDAB (andreas.hartmetz@kdab.com)
8 **
9 ** Contact: Nokia Corporation (qt-info@nokia.com)
10 **
11 ** No Commercial Usage
12 **
13 ** This file contains pre-release code and may not be distributed.
14 ** You may use this file in accordance with the terms and conditions
15 ** contained in the Technology Preview License Agreement accompanying
16 ** this package.
17 **
18 ** GNU Lesser General Public License Usage
19 **
20 ** Alternatively, this file may be used under the terms of the GNU Lesser
21 ** General Public License version 2.1 as published by the Free Software
22 ** Foundation and appearing in the file LICENSE.LGPL included in the
23 ** packaging of this file.  Please review the following information to
24 ** ensure the GNU Lesser General Public License version 2.1 requirements
25 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
26 **
27 ** In addition, as a special exception, Nokia gives you certain additional
28 ** rights.  These rights are described in the Nokia Qt LGPL Exception
29 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
30 **
31 ** If you have questions regarding the use of this file, please contact
32 ** Nokia at qt-info@nokia.com.
33 **
34 **************************************************************************/
35
36 #ifndef LIBVALGRIND_PROTOCOL_THREADEDPARSER_H
37 #define LIBVALGRIND_PROTOCOL_THREADEDPARSER_H
38
39 #include "../valgrind_global.h"
40
41 #include <QtCore/QObject>
42
43 QT_BEGIN_NAMESPACE
44 class QIODevice;
45 QT_END_NAMESPACE
46
47 namespace Valgrind {
48 namespace XmlProtocol {
49
50 class Error;
51 class Status;
52
53 /**
54  * ThreadedParser for the Valgrind Output XmlProtocol 4
55  */
56 class VALGRINDSHARED_EXPORT ThreadedParser : public QObject {
57     Q_OBJECT
58 public:
59     explicit ThreadedParser(QObject *parent=0);
60     ~ThreadedParser();
61
62     QString errorString() const;
63
64     /// interface additions relative to Parser because Parser is synchronous and this
65     /// class parses asynchronously in a non-public secondary thread.
66     bool waitForFinished();
67     bool isRunning() const;
68
69 public Q_SLOTS:
70     ///@warning will move @p stream to a different thread and take ownership of it
71     void parse(QIODevice *stream);
72
73 private Q_SLOTS:
74     void slotInternalError(const QString &errorString);
75
76 Q_SIGNALS:
77     void status(const Valgrind::XmlProtocol::Status &status);
78     void error(const Valgrind::XmlProtocol::Error &error);
79     void internalError(const QString &errorString);
80     void errorCount(qint64 unique, qint64 count);
81     void suppressionCount(const QString &name, qint64 count);
82     void finished();
83
84 private:
85     Q_DISABLE_COPY(ThreadedParser)
86
87     class Private;
88     Private *const d;
89 };
90
91 } // XmlProtocol
92 } // Valgrind
93
94 #endif //LIBVALGRIND_PROTOCOL_THREADEDPARSER_H