IOutputParser: Replace std{Out,Err} with a single parameterized function

Another step towards parser/formatter unification.

Task-number: QTCREATORBUG-22665
Change-Id: I6de86b3aee2c54585cdd4b06d21b0ea67300aeac
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2020-04-08 09:42:51 +02:00
parent ad1f79075d
commit 98fb412e6e
44 changed files with 253 additions and 182 deletions

View File

@@ -57,10 +57,14 @@ void CMakeParser::setSourceDirectory(const QString &sourceDir)
m_sourceDirectory = QDir(sourceDir);
}
void CMakeParser::stdError(const QString &line)
void CMakeParser::handleLine(const QString &line, OutputFormat type)
{
QString trimmedLine = rightTrimmed(line);
if (type != StdErrFormat) {
IOutputParser::handleLine(line, type);
return;
}
QString trimmedLine = rightTrimmed(line);
switch (m_expectTripleLineErrorData) {
case NONE:
if (trimmedLine.isEmpty() && !m_lastTask.isNull()) {
@@ -110,7 +114,7 @@ void CMakeParser::stdError(const QString &line)
// Do not pass on lines starting with "-- " or "* ". Those are typical CMake output
return;
}
IOutputParser::stdError(line);
IOutputParser::handleLine(line, StdErrFormat);
return;
case LINE_LOCATION:
{

View File

@@ -43,12 +43,11 @@ class CMAKE_EXPORT CMakeParser : public ProjectExplorer::IOutputParser
public:
explicit CMakeParser();
void setSourceDirectory(const QString &sourceDir);
void stdError(const QString &line) override;
protected:
void doFlush() override;
private:
void handleLine(const QString &line, Utils::OutputFormat type) override;
void doFlush() override;
enum TripleLineError { NONE, LINE_LOCATION, LINE_DESCRIPTION, LINE_DESCRIPTION2 };
TripleLineError m_expectTripleLineErrorData = NONE;

View File

@@ -361,7 +361,7 @@ void ServerModeReader::createNewServer()
connect(m_cmakeServer.get(), &ServerMode::cmakeMessage, [this](const QString &m) {
const QStringList lines = m.split('\n');
for (const QString &l : lines) {
m_parser.stdError(l);
m_parser.handleStderr(l);
Core::MessageManager::write(l);
}
});