kgpg
#include <klinebufferedprocess.h>
Signals | |
void | lineReadyStandardError () |
void | lineReadyStandardOutput () |
Public Member Functions | |
KLineBufferedProcess (QObject *parent=0) | |
~KLineBufferedProcess () | |
bool | hasLineStandardError () const |
bool | hasLineStandardOutput () const |
bool | readLineStandardError (QByteArray *line) |
bool | readLineStandardOutput (QByteArray *line) |
Detailed Description
Read output of a process split into lines.
This class reads the output of a process and splits it up into lines. This is especially useful if you try to parse the output of a command line tool.
Usage
The class is created and set up like a KProcess. After this you can do something like this:
Never use the read functionality of KProcess with this class. This class needs to read all data from the process into an internal buffer first. If you try to use the read functions of the parent classes you would normally get no output at all.
The write functions of the parent classes are not effected. You can use them exactly the same way as in KProcess.
Definition at line 56 of file klinebufferedprocess.h.
Constructor & Destructor Documentation
|
explicit |
Constructor.
Definition at line 45 of file klinebufferedprocess.cpp.
KLineBufferedProcess::~KLineBufferedProcess | ( | ) |
Destructor.
Definition at line 53 of file klinebufferedprocess.cpp.
Member Function Documentation
bool KLineBufferedProcess::hasLineStandardError | ( | ) | const |
Checks if a line is ready on stdout.
- Returns
- true if a complete line can be read
Definition at line 123 of file klinebufferedprocess.cpp.
bool KLineBufferedProcess::hasLineStandardOutput | ( | ) | const |
Checks if a line is ready on stdout.
- Returns
- true if a complete line can be read
Definition at line 118 of file klinebufferedprocess.cpp.
|
signal |
Emitted when there is a line of data available from stderr when there was previously none.
There may or may not be more than one line available for reading when this signal is emitted.
|
signal |
Emitted when there is a line of data available from stdout when there was previously none.
There may or may not be more than one line available for reading when this signal is emitted.
bool KLineBufferedProcess::readLineStandardError | ( | QByteArray * | line | ) |
Reads a line of text (excluding '\n') from stderr.
Use readLineStderr() in response to a lineReadyStderr() signal or when hasLineStderr() returns true. You may use it multiple times if more than one line of data is available. If no complete line is available the content of line is undefined and the function returns false.
- Parameters
-
line is used to store the line that was read.
- Returns
- if data was read or not
Definition at line 103 of file klinebufferedprocess.cpp.
bool KLineBufferedProcess::readLineStandardOutput | ( | QByteArray * | line | ) |
Reads a line of text (excluding '\n') from stdout.
Use readLineStdout() in response to a lineReadyStdout() signal or when hasLineStdout() returns true. You may use it multiple times if more than one line of data is available. If no complete line is available the content of line is undefined and the function returns false.
- Parameters
-
line is used to store the line that was read.
- Returns
- if data was read or not
Definition at line 88 of file klinebufferedprocess.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:42:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.