File indexing completed on 2024-12-08 10:25:56
0001 /* 0002 SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #pragma once 0007 0008 #include <KSyntaxHighlighting/AbstractHighlighter> 0009 0010 class QTextStream; 0011 0012 class TextHighlighter : public KSyntaxHighlighting::AbstractHighlighter 0013 { 0014 public: 0015 explicit TextHighlighter(QTextStream *stream); 0016 ~TextHighlighter() override = default; 0017 0018 void highlight(const QString &str); 0019 0020 protected: 0021 void applyFormat(int offset, int length, const KSyntaxHighlighting::Format &format) override; 0022 0023 private: 0024 QString mCurrentLine; 0025 QTextStream *const mStream; 0026 };