KPty
KPtyDevice Class Reference
Encapsulates KPty into a QIODevice, so it can be used with Q*Stream, etc. More...
#include <kptydevice.h>

Signals | |
void | readEof () |
void | readyRead () |
Public Member Functions | |
bool | atEnd () const |
qint64 | bytesAvailable () const |
qint64 | bytesToWrite () const |
bool | canReadLine () const |
virtual void | close () |
virtual bool | isSequential () const |
bool | isSuspended () const |
KPtyDevice (QObject *parent=0) | |
bool | open (int fd, OpenMode mode=ReadWrite|Unbuffered) |
virtual bool | open (OpenMode mode=ReadWrite|Unbuffered) |
void | setSuspended (bool suspended) |
bool | waitForBytesWritten (int msecs=-1) |
bool | waitForReadyRead (int msecs=-1) |
virtual | ~KPtyDevice () |
Protected Member Functions | |
virtual qint64 | readData (char *data, qint64 maxSize) |
virtual qint64 | readLineData (char *data, qint64 maxSize) |
virtual qint64 | writeData (const char *data, qint64 maxSize) |
Detailed Description
Encapsulates KPty into a QIODevice, so it can be used with Q*Stream, etc.
Definition at line 38 of file kptydevice.h.
Constructor & Destructor Documentation
KPtyDevice::KPtyDevice | ( | QObject * | parent = 0 |
) |
Constructor.
Definition at line 462 of file kptydevice.cpp.
KPtyDevice::~KPtyDevice | ( | ) | [virtual] |
Destructor:.
If the pty is still open, it will be closed. Note, however, that an utmp registration is not undone.
Definition at line 468 of file kptydevice.cpp.
Member Function Documentation
bool KPtyDevice::atEnd | ( | ) | const |
- Reimplemented from superclass.
Definition at line 530 of file kptydevice.cpp.
qint64 KPtyDevice::bytesAvailable | ( | ) | const |
- Reimplemented from superclass.
Definition at line 536 of file kptydevice.cpp.
qint64 KPtyDevice::bytesToWrite | ( | ) | const |
- Reimplemented from superclass.
Definition at line 542 of file kptydevice.cpp.
bool KPtyDevice::canReadLine | ( | ) | const |
- Reimplemented from superclass.
Definition at line 524 of file kptydevice.cpp.
void KPtyDevice::close | ( | ) | [virtual] |
Close the pty master/slave pair.
Reimplemented from KPty.
Definition at line 504 of file kptydevice.cpp.
bool KPtyDevice::isSequential | ( | ) | const [virtual] |
- Returns:
- always true
Definition at line 519 of file kptydevice.cpp.
bool KPtyDevice::isSuspended | ( | ) | const |
Returns true if the KPtyDevice is not monitoring the pty for incoming data.
Do not use on closed ptys.
See setSuspended()
Definition at line 566 of file kptydevice.cpp.
bool KPtyDevice::open | ( | int | fd, | |
OpenMode | mode = ReadWrite | Unbuffered | |||
) |
Open using an existing pty master.
The ownership of the fd remains with the caller, i.e., close() will not close the fd.
This is useful if you wish to attach a secondary "controller" to an existing pty device such as a terminal widget. Note that you will need to use setSuspended() on both devices to control which one gets the incoming data from the pty.
- Parameters:
-
fd an open pty master file descriptor. mode the device mode to open the pty with.
- Returns:
- true if a pty pair was successfully opened
Definition at line 490 of file kptydevice.cpp.
bool KPtyDevice::open | ( | OpenMode | mode = ReadWrite | Unbuffered |
) | [virtual] |
Create a pty master/slave pair.
- Returns:
- true if a pty pair was successfully opened
Definition at line 473 of file kptydevice.cpp.
Definition at line 573 of file kptydevice.cpp.
void KPtyDevice::readEof | ( | ) | [signal] |
Emitted when EOF is read from the PTY.
Data may still remain in the buffers.
Definition at line 580 of file kptydevice.cpp.
void KPtyDevice::readyRead | ( | ) | [signal] |
- Reimplemented from superclass.
void KPtyDevice::setSuspended | ( | bool | suspended | ) |
Sets whether the KPtyDevice monitors the pty for incoming data.
When the KPtyDevice is suspended, it will no longer attempt to buffer data that becomes available from the pty and it will not emit any signals.
Do not use on closed ptys. After a call to open(), the pty is not suspended. If you need to ensure that no data is read, call this function before the main loop is entered again (i.e., immediately after opening the pty).
Definition at line 560 of file kptydevice.cpp.
bool KPtyDevice::waitForBytesWritten | ( | int | msecs = -1 |
) |
Definition at line 554 of file kptydevice.cpp.
bool KPtyDevice::waitForReadyRead | ( | int | msecs = -1 |
) |
Definition at line 548 of file kptydevice.cpp.
Definition at line 587 of file kptydevice.cpp.
The documentation for this class was generated from the following files: