1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
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
16 ** GNU Lesser General Public License Usage
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.
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.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #ifndef IOUTPUTPARSER_H
35 #define IOUTPUTPARSER_H
37 #include "projectexplorer_export.h"
38 #include "buildstep.h"
40 #include <QtCore/QString>
42 namespace ProjectExplorer {
45 class PROJECTEXPLORER_EXPORT IOutputParser : public QObject
50 virtual ~IOutputParser();
52 /// Append a subparser to this parser.
53 /// IOutputParser will take ownership.
54 virtual void appendOutputParser(IOutputParser *parser);
56 /// Remove the appended outputparser chain frm this parser.
57 /// This method transferes ownership of the parser chain to the caller!
58 IOutputParser *takeOutputParserChain();
60 /// Return the head of this parsers output parser children
61 /// IOutputParser keeps ownership!
62 IOutputParser *childParser() const;
63 void setChildParser(IOutputParser *parser);
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);
70 // This is mainly a symbian specific quirk
71 virtual bool hasFatalErrors() const;
73 virtual void setWorkingDirectory(const QString &workingDirectory);
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
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);
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);
93 IOutputParser *m_parser;
96 } // namespace ProjectExplorer
98 Q_DECLARE_METATYPE(ProjectExplorer::IOutputParser*)
100 #endif // IOUTPUTPARSER_H