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