File indexing completed on 2024-04-28 03:51:47

0001 /*
0002     This file is part of the KDE Baloo Project
0003     SPDX-FileCopyrightText: 2021 Stefan BrĂ¼ns <stefan.bruens@rwth-aachen.de>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 
0008 #ifndef COMMANDPIPE_H
0009 #define COMMANDPIPE_H
0010 
0011 #include <QDataStream>
0012 #include <QObject>
0013 
0014 class QIODevice;
0015 
0016 namespace Baloo {
0017 namespace Private {
0018 
0019 /**
0020  * Bidirectional communication pipe
0021  *
0022  */
0023 class ControllerPipe : public QObject
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     ControllerPipe(QIODevice* commandPipe, QIODevice* statusPipe);
0029 
0030     void processIds(const QVector<quint64>& ids);
0031 
0032 Q_SIGNALS:
0033     void urlStarted(const QString& url);
0034     void urlFinished(const QString& url);
0035     void urlFailed(const QString& url);
0036     void batchFinished();
0037 
0038 public Q_SLOTS:
0039     void processStatusData();
0040 
0041 private:
0042     QDataStream m_commandStream;
0043     QDataStream m_statusStream;
0044 };
0045 
0046 class WorkerPipe : public QObject
0047 {
0048     Q_OBJECT
0049 
0050 public:
0051     WorkerPipe(QIODevice* commandPipe, QIODevice* statusPipe);
0052 
0053     void urlStarted(const QString& url);
0054     void urlFinished(const QString& url);
0055     void urlFailed(const QString& url);
0056     void batchFinished();
0057 
0058 public Q_SLOTS:
0059     void processIdData();
0060 
0061 Q_SIGNALS:
0062     void newDocumentIds(const QVector<quint64>& ids);
0063     void inputEnd();
0064 
0065 private:
0066     QDataStream m_commandStream;
0067     QDataStream m_statusStream;
0068 };
0069 
0070 } // namespace Private
0071 } // namespace Baloo
0072 #endif