forked from qt-creator/qt-creator
Replace the current license disclaimer in files by a SPDX-License-Identifier. Task-number: QTBUG-67283 Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
40 lines
982 B
C++
40 lines
982 B
C++
// Copyright (C) 2016 Petar Perisin <petar.perisin@gmail.com>
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
|
|
|
#pragma once
|
|
|
|
#include "utils_global.h"
|
|
|
|
#include <QTextCharFormat>
|
|
|
|
namespace Utils {
|
|
|
|
class QTCREATOR_UTILS_EXPORT FormattedText {
|
|
public:
|
|
FormattedText() = default;
|
|
FormattedText(const QString &txt, const QTextCharFormat &fmt = QTextCharFormat()) :
|
|
text(txt), format(fmt)
|
|
{ }
|
|
|
|
QString text;
|
|
QTextCharFormat format;
|
|
};
|
|
|
|
class QTCREATOR_UTILS_EXPORT AnsiEscapeCodeHandler
|
|
{
|
|
public:
|
|
QList<FormattedText> parseText(const FormattedText &input);
|
|
void endFormatScope();
|
|
|
|
private:
|
|
void setFormatScope(const QTextCharFormat &charFormat);
|
|
|
|
bool m_previousFormatClosed = true;
|
|
bool m_waitingForTerminator = false;
|
|
QString m_alternateTerminator;
|
|
QTextCharFormat m_previousFormat;
|
|
QString m_pendingText;
|
|
};
|
|
|
|
} // namespace Utils
|