File indexing completed on 2024-05-05 17:57:40

0001 /*
0002     SPDX-FileCopyrightText: 2001 Shie Erlich <krusader@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2001 Rafi Yanai <krusader@users.sourceforge.net>
0004     SPDX-FileCopyrightText: 2004-2022 Krusader Krew <https://krusader.org>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef KRLINECOUNTINGPROCESS_H
0010 #define KRLINECOUNTINGPROCESS_H
0011 
0012 #include <KCoreAddons/KProcess>
0013 
0014 /**
0015  * A KProcess which emits how many lines it is writing to stdout or stderr.
0016  */
0017 class KrLinecountingProcess : public KProcess
0018 {
0019     Q_OBJECT
0020 public:
0021     KrLinecountingProcess();
0022     void setMerge(bool);
0023     QString getErrorMsg();
0024 
0025 public slots:
0026     void receivedError();
0027     void receivedOutput(QByteArray = QByteArray());
0028 
0029 signals:
0030     void newOutputLines(int);
0031     void newErrorLines(int);
0032     void newOutputData(KProcess *, QByteArray &);
0033 
0034 private:
0035     QByteArray errorData;
0036     QByteArray outputData;
0037 
0038     bool mergedOutput;
0039 };
0040 
0041 #endif // KRLINECOUNTINGPROCESS_H