• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeutils API Reference
  • KDE Home
  • Contact Us
 

kgpg

Signals | Public Member Functions | List of all members
KLineBufferedProcess Class Reference

#include <klinebufferedprocess.h>

Inheritance diagram for KLineBufferedProcess:
Inheritance graph
[legend]

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:

connect(m_linebufprocess, SIGNAL(lineReadyStandardOutput()), SLOT(dataStdout()));
...
void myobj::dataStdout()
{
while (m_linebufprocess->hasLineStandardOutput()) {
QByteArray line;
m_linebufprocess->readLineStandardOutput(line);
...
}
}

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.

Author
Rolf Eike Beer

Definition at line 56 of file klinebufferedprocess.h.

Constructor & Destructor Documentation

KLineBufferedProcess::KLineBufferedProcess ( QObject *  parent = 0)
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.

void KLineBufferedProcess::lineReadyStandardError ( )
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.

void KLineBufferedProcess::lineReadyStandardOutput ( )
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
lineis 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
lineis 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:
  • klinebufferedprocess.h
  • klinebufferedprocess.cpp
This file is part of the KDE documentation.
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.

kgpg

Skip menu "kgpg"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • ktimer
  • kwallet
  • sweeper

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal