File indexing completed on 2025-01-05 05:23:52

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2023 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef KASTEN_ABSTRACTBYTEARRAYCOLUMNHTMLRENDERER_HPP
0010 #define KASTEN_ABSTRACTBYTEARRAYCOLUMNHTMLRENDERER_HPP
0011 
0012 // lib
0013 #include "abstractcolumnhtmlrenderer.hpp"
0014 // Okteta gui
0015 #include <Okteta/CoordRange>
0016 
0017 namespace Okteta {
0018 class AbstractByteArrayModel;
0019 }
0020 
0021 namespace Kasten {
0022 
0023 // TODO: offset should be set in renderFirstLine, calculated using coordRange,
0024 // in constructor instead take startOffset
0025 class AbstractByteArrayColumnHtmlRenderer : public AbstractColumnHtmlRenderer
0026 {
0027 public:
0028     AbstractByteArrayColumnHtmlRenderer(const Okteta::AbstractByteArrayModel* byteArrayModel, Okteta::Address offset,
0029                                         const Okteta::CoordRange& coordRange,
0030                                         int noOfBytesPerLine);
0031     ~AbstractByteArrayColumnHtmlRenderer() override;
0032 
0033 public: // AbstractColumnHtmlRenderer API
0034     void renderFirstLine(QTextStream* stream, int lineIndex) const override;
0035     void renderNextLine(QTextStream* stream, bool isSubline) const override;
0036 
0037 protected: // API to be reimplemented by subclasses
0038     virtual void renderLine(QTextStream* stream, bool isSubline) const = 0;
0039 
0040 protected:
0041     const Okteta::AbstractByteArrayModel* const mByteArrayModel;
0042 
0043     const Okteta::CoordRange mCoordRange;
0044 
0045     const int mNoOfBytesPerLine;
0046 
0047     /** Line to print */
0048     mutable int mRenderLine;
0049     /** Data to print */
0050     mutable Okteta::Address mOffset;
0051 };
0052 
0053 }
0054 
0055 #endif