summaryrefslogtreecommitdiff
path: root/src/plugins/boostbuildprojectmanager/b2outputparser.h
blob: a2f54cf59ce270f0081960a9ab83d18ce845fa5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// Copyright (C) 2013 Mateusz Łoskot <mateusz@loskot.net>
//
// This file is part of Qt Creator Boost.Build plugin project.
//
// This is free software; you can redistribute and/or modify it under
// the terms of the GNU Lesser General Public License, Version 2.1
// as published by the Free Software Foundation.
// See accompanying file LICENSE.txt or copy at
// http://www.gnu.org/licenses/lgpl-2.1-standalone.html.
//
#ifndef BBOUTPUTPARSER_HPP
#define BBOUTPUTPARSER_HPP

// Qt Creator
#include <projectexplorer/ioutputparser.h>
#include <projectexplorer/task.h>
// Qt
#include <QPointer>
#include <QString>

namespace BoostBuildProjectManager {
namespace Internal {

class BoostBuildParser : public ProjectExplorer::IOutputParser
{
    Q_OBJECT

public:
    BoostBuildParser();

    void stdOutput(QString const& line);
    void stdError(QString const& line);

protected:
    void doFlush();

private:

    QString findToolset(QString const& line) const;
    void setToolsetParser(QString const& toolsetName);
    void setTask(ProjectExplorer::Task const& task);

    QRegExp rxToolsetNameCommand_; // ".compile." command line
    QRegExp rxToolsetNameWarning_; // "warning: " status line
    QRegExp rxTestPassed_; // "**passed**" status line
    QRegExp rxTestFailed_; // "...failed testing" status line
    QRegExp rxTestFailedAsExpected_; // "(failed-as-expected)" status line
    QRegExp rxTestFileLineN_; // file.cpp(XX) => file.cpp:XX
    QRegExp rxTestFileObj_; // file.o => file.cpp
    QString toolsetName_;

    // Boost.Build command mode relates to first command token in line.
    enum LineMode { Common, Toolset, Testing };
    LineMode lineMode_;

    ProjectExplorer::Task lastTask_;
    QPointer<ProjectExplorer::IOutputParser> parser_;
};

} // namespace Internal
} // namespace BoostBuildProjectManager

#endif // BBOUTPUTPARSER_HPP