OSDN Git Service

It's 2011 now.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / projectexplorer / ioutputparser.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 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef IOUTPUTPARSER_H
35 #define IOUTPUTPARSER_H
36
37 #include "projectexplorer_export.h"
38 #include "buildstep.h"
39
40 #include <QtCore/QString>
41
42 namespace ProjectExplorer {
43 class Task;
44
45 class PROJECTEXPLORER_EXPORT IOutputParser : public QObject
46 {
47     Q_OBJECT
48 public:
49     IOutputParser();
50     virtual ~IOutputParser();
51
52     /// Append a subparser to this parser.
53     /// IOutputParser will take ownership.
54     virtual void appendOutputParser(IOutputParser *parser);
55
56     /// Remove the appended outputparser chain frm this parser.
57     /// This method transferes ownership of the parser chain to the caller!
58     IOutputParser *takeOutputParserChain();
59
60     /// Return the head of this parsers output parser children
61     /// IOutputParser keeps ownership!
62     IOutputParser *childParser() const;
63     void setChildParser(IOutputParser *parser);
64
65     /// Called once for each line if standard output to parse.
66     virtual void stdOutput(const QString &line);
67     /// Called once for each line if standard error to parse.
68     virtual void stdError(const QString &line);
69
70     // This is mainly a symbian specific quirk
71     virtual bool hasFatalErrors() const;
72     // For GnuMakeParser
73     virtual void setWorkingDirectory(const QString &workingDirectory);
74
75 signals:
76     /// Should be emitted whenever some additional information should be
77     /// added to the output.
78     /// Note: This is additional information. There is no need to add each
79     /// line!
80     void addOutput(const QString &string, ProjectExplorer::BuildStep::OutputFormat format);
81     /// Should be emitted for each task seen in the output.
82     void addTask(const ProjectExplorer::Task &task);
83
84 public slots:
85     /// Subparsers have their addOutput signal connected to this slot.
86     /// This method can be overwritten to change the string.
87     virtual void outputAdded(const QString &string, ProjectExplorer::BuildStep::OutputFormat format);
88     /// Subparsers have their addTask signal connected to this slot.
89     /// This method can be overwritten to change the task.
90     virtual void taskAdded(const ProjectExplorer::Task &task);
91
92 private:
93     IOutputParser *m_parser;
94 };
95
96 } // namespace ProjectExplorer
97
98 Q_DECLARE_METATYPE(ProjectExplorer::IOutputParser*)
99
100 #endif // IOUTPUTPARSER_H