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

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2007-2008 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_BYTEARRAYVIEWTEXTSTREAMENCODER_HPP
0010 #define KASTEN_BYTEARRAYVIEWTEXTSTREAMENCODER_HPP
0011 
0012 // lib
0013 #include "abstractbytearraystreamencoder.hpp"
0014 // Okteta gui
0015 // #include <Okteta/OffsetFormat>
0016 // Okteta core
0017 #include <Okteta/OktetaCore>
0018 // Qt
0019 #include <QString>
0020 
0021 namespace Kasten {
0022 
0023 class ByteArrayViewTextStreamEncoderSettings
0024 {
0025 public:
0026     ByteArrayViewTextStreamEncoderSettings();
0027     ByteArrayViewTextStreamEncoderSettings(const ByteArrayViewTextStreamEncoderSettings&) = default;
0028 
0029     ~ByteArrayViewTextStreamEncoderSettings() = default;
0030 
0031     ByteArrayViewTextStreamEncoderSettings& operator=(const ByteArrayViewTextStreamEncoderSettings&) = default;
0032 
0033 public:
0034 //     Okteta::OffsetFormat::Format offsetFormat;
0035     int codingWidth;
0036     int firstLineOffset;
0037     int startOffset;
0038     int delta;
0039     Okteta::ValueCoding valueCoding = Okteta::HexadecimalCoding;
0040     QString codecName;
0041     QChar undefinedChar = {QLatin1Char('?')};
0042     QChar substituteChar = {QLatin1Char('.')};
0043     QString separation;
0044 //     Okteta::CharCodec *CharCodec;
0045 //     Okteta::OffsetFormat::print printFunction;
0046 };
0047 
0048 // TODO: this could rather be one of the default cop
0049 class ByteArrayViewTextStreamEncoder : public AbstractByteArrayStreamEncoder
0050 {
0051     Q_OBJECT
0052 
0053 public:
0054     ByteArrayViewTextStreamEncoder();
0055     ~ByteArrayViewTextStreamEncoder() override;
0056 
0057 protected: // AbstractByteArrayStreamEncoder API
0058     bool encodeDataToStream(QIODevice* device,
0059                             const ByteArrayView* byteArrayView,
0060                             const Okteta::AbstractByteArrayModel* byteArrayModel,
0061                             const Okteta::AddressRange& range) override;
0062 
0063 private:
0064     ByteArrayViewTextStreamEncoderSettings mSettings;
0065 };
0066 
0067 }
0068 
0069 #endif