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

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2010 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_BYTEARRAYBASE85STREAMENCODER_HPP
0010 #define KASTEN_BYTEARRAYBASE85STREAMENCODER_HPP
0011 
0012 // lib
0013 #include "abstractbytearraystreamencoder.hpp"
0014 // Okteta core
0015 #include <Okteta/OktetaCore>
0016 // Qt
0017 #include <QString>
0018 
0019 namespace Kasten {
0020 
0021 class ByteArrayBase85StreamEncoder : public AbstractByteArrayStreamEncoder
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     static constexpr int inputGroupLength = 4;
0027 
0028     static constexpr int outputLineLength = 72;
0029     static constexpr int maxOutputBytesPerLine = outputLineLength;
0030 
0031     enum class InputByteIndex
0032     {
0033         First = 0,
0034         Second,
0035         Third,
0036         Fourth
0037     };
0038 
0039 public:
0040     ByteArrayBase85StreamEncoder();
0041     ~ByteArrayBase85StreamEncoder() override;
0042 
0043 protected: // AbstractByteArrayStreamEncoder API
0044     bool encodeDataToStream(QIODevice* device,
0045                             const ByteArrayView* byteArrayView,
0046                             const Okteta::AbstractByteArrayModel* byteArrayModel,
0047                             const Okteta::AddressRange& range) override;
0048 };
0049 
0050 }
0051 
0052 #endif