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

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2008-2009 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_BYTEARRAYSEARCHJOB_HPP
0010 #define KASTEN_BYTEARRAYSEARCHJOB_HPP
0011 
0012 // Okteta core
0013 #include <Okteta/AddressRange>
0014 // Qt
0015 #include <QObject>
0016 #include <QByteArray>
0017 
0018 namespace Okteta {
0019 class AbstractByteArrayModel;
0020 class CharCodec;
0021 }
0022 
0023 namespace Kasten {
0024 
0025 class ByteArraySearchJob : public QObject // not yet: KJob
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     ByteArraySearchJob(const Okteta::AbstractByteArrayModel* model,
0031                        const QByteArray& searchData,
0032                        Okteta::Address startIndex, Okteta::Address endIndex,
0033                        Qt::CaseSensitivity caseSensitivity, const QString& charCodecName);
0034 
0035     ~ByteArraySearchJob() override;
0036 
0037 public:
0038     Okteta::AddressRange exec();
0039     void start();
0040 
0041 Q_SIGNALS:
0042     void finished(Okteta::AddressRange position);
0043 
0044 private Q_SLOTS:
0045     void onBytesSearched();
0046 
0047 private:
0048     const Okteta::AbstractByteArrayModel* mByteArrayModel;
0049 
0050     QByteArray mSearchData;
0051     Okteta::Address mStartIndex;
0052     Okteta::Address mEndIndex;
0053     Qt::CaseSensitivity mCaseSensitivity;
0054     const Okteta::CharCodec* mCharCodec;
0055 
0056     Okteta::AddressRange m_result;
0057 };
0058 
0059 }
0060 
0061 #endif