File indexing completed on 2024-05-26 05:56:31
0001 /* 0002 This file is part of the Okteta Kasten module, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2008, 2022 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_ABSTRACTBYTEARRAYFILTER_HPP 0010 #define KASTEN_ABSTRACTBYTEARRAYFILTER_HPP 0011 0012 // Okteta core 0013 #include <Okteta/AddressRange> 0014 #include <Okteta/Byte> 0015 // Qt 0016 #include <QObject> 0017 // Std 0018 #include <memory> 0019 0020 class AbstractByteArrayFilterParameterSet; 0021 namespace Okteta { 0022 class AbstractByteArrayModel; 0023 } 0024 class KConfigGroup; 0025 class QString; 0026 0027 class AbstractByteArrayFilter : public QObject 0028 { 0029 Q_OBJECT 0030 0031 protected: 0032 static constexpr int FilteredByteCountSignalLimit = 10000; 0033 0034 protected: 0035 explicit AbstractByteArrayFilter(const QString& name, const QString& id); 0036 0037 public: 0038 ~AbstractByteArrayFilter() override; 0039 0040 public: // API to be implemented 0041 virtual bool filter(Okteta::Byte* result, Okteta::AbstractByteArrayModel* model, const Okteta::AddressRange& range) const = 0; 0042 /** used by the editor to get write access to the parameters */ 0043 virtual AbstractByteArrayFilterParameterSet* parameterSet() = 0; 0044 virtual void loadConfig(const KConfigGroup& configGroup); 0045 virtual void saveConfig(KConfigGroup& configGroup) const; 0046 0047 public: 0048 QString name() const; 0049 QString id() const; 0050 0051 Q_SIGNALS: // TODO: add check for signal to tests 0052 void filteredBytes(int bytes) const; 0053 0054 private: 0055 const std::unique_ptr<class AbstractByteArrayFilterPrivate> d; 0056 }; 0057 0058 #endif