Qt Cryptographic Architecture: QCA::QPipeEnd Class Reference

Qt Cryptographic Architecture

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Signals | Public Member Functions | Friends | List of all members
QCA::QPipeEnd Class Reference
QCA user API

`#include <QtCrypto>`

Collaboration diagram for QCA::QPipeEnd:
[legend]

## Public Types
enum | Error { ErrorEOF, ErrorBroken }

## Signals
void | bytesWritten (int bytes)
void | closed ()
void | error (QCA::QPipeEnd::Error e)
void | readyRead ()

## Public Member Functions
int | bytesAvailable () const
int | bytesToWrite () const
void | close ()
void | enable ()
void | finalize ()
void | finalizeAndRelease ()
Q_PIPE_ID | id () const
int | idAsInt () const
bool | isValid () const
| QPipeEnd (QObject *parent=0)
QByteArray | read (int bytes=-1)
SecureArray | readSecure (int bytes=-1)
void | release ()
void | reset ()
bool | setInheritable (bool enabled)
void | setSecurityEnabled (bool secure)
void | take (Q_PIPE_ID id, QPipeDevice::Type t)
QByteArray | takeBytesToWrite ()
SecureArray | takeBytesToWriteSecure ()
QPipeDevice::Type | type () const
void | write (const QByteArray &a)
void | writeSecure (const SecureArray &a)

## Friends
class | Private

## Detailed Description

A buffered higher-level pipe end.

This is either the read end or write end of a QPipe.

## Member Enumeration Documentation

enum QCA::QPipeEnd::Error

The type of error.

Enumerator
ErrorEOF | End of file error.
ErrorBroken | Broken pipe error.

## Constructor & Destructor Documentation

QCA::QPipeEnd::QPipeEnd | ( | QObject * | parent = `0` | ) |

Standard constructor.

Parameters

  parent | the parent object for this object

## Member Function Documentation

void QCA::QPipeEnd::reset | ( |  | ) |

Reset the pipe end to an inactive state.

QPipeDevice::Type QCA::QPipeEnd::type | ( |  | ) | const

The type of pipe end (either read or write)

bool QCA::QPipeEnd::isValid | ( |  | ) | const

Determine whether the pipe end is valid.

Note
  This does not mean the pipe is ready to be used - you may need to call enable() first

Q_PIPE_ID QCA::QPipeEnd::id | ( |  | ) | const

Pipe identification.

int QCA::QPipeEnd::idAsInt | ( |  | ) | const

Pipe identification.

void QCA::QPipeEnd::take | ( | Q_PIPE_ID | id,
|  | QPipeDevice::Type | t
| ) |  |

Take over an existing pipe handle.

Parameters

  id | the pipe handle
  t | the type of the pipe (read or write)

void QCA::QPipeEnd::setSecurityEnabled | ( | bool | secure | ) |

Sets whether the pipe uses secure memory for read/write.

Enabling this may reduce performance, and it should only be used if sensitive data is being transmitted (such as a passphrase).

Parameters

  secure | whether the pipe uses secure memory (true) or not (false).

void QCA::QPipeEnd::enable | ( |  | ) |

Enable the endpoint for the pipe.

When an endpoint is created, it is not able to be used until it is enabled.

void QCA::QPipeEnd::close | ( |  | ) |

Close the end of the pipe.

See also
  closed()

void QCA::QPipeEnd::release | ( |  | ) |

Let go of the active pipe handle, but don't close it.

Use this before destructing QPipeEnd, if you don't want the pipe to automatically close.

bool QCA::QPipeEnd::setInheritable | ( | bool | enabled | ) |

Sets whether the pipe should be inheritable to child processes.

Returns true if inheritability was successfully changed, otherwise false.

Parameters

  enabled | whether the pipe is inheritable (true) or not (false).

void QCA::QPipeEnd::finalize | ( |  | ) |

Clear the contents of the pipe, and invalidate the pipe.

void QCA::QPipeEnd::finalizeAndRelease | ( |  | ) |

Clear the contents of the pipe, and release the pipe.

int QCA::QPipeEnd::bytesAvailable | ( |  | ) | const

Determine how many bytes are available to be read.

This only makes sense at the read end of the pipe

See also
  readyRead() for a signal that can be used to determine when there are bytes available to read.

int QCA::QPipeEnd::bytesToWrite | ( |  | ) | const

Returns the number of bytes pending to write.

This only makes sense at the write end of the pipe

See also
  bytesWritten() for a signal that can be used to determine when bytes have been written

QByteArray QCA::QPipeEnd::read | ( | int | bytes = `-1` | ) |

Read bytes from the pipe.

You can only call this on the read end of the pipe

If the pipe is using secure memory, you should use readSecure()

Parameters

  bytes | the number of bytes to read (-1 for all content).

void QCA::QPipeEnd::write | ( | const QByteArray & | a | ) |

Write bytes to the pipe.

You can only call this on the write end of the pipe.

If the pipe is using secure memory, you should use writeSecure().

Parameters

  a | the array to write to the pipe

SecureArray QCA::QPipeEnd::readSecure | ( | int | bytes = `-1` | ) |

Read bytes from the pipe.

You can only call this on the read end of the pipe

If the pipe is using insecure memory, you should use read()

Parameters

  bytes | the number of bytes to read (-1 for all content).

void QCA::QPipeEnd::writeSecure | ( | const SecureArray & | a | ) |

Write bytes to the pipe.

You can only call this on the write end of the pipe.

If the pipe is using insecure memory, you should use write().

Parameters

  a | the array to write to the pipe

QByteArray QCA::QPipeEnd::takeBytesToWrite | ( |  | ) |

Returns any unsent bytes queued for writing.

If the pipe is using secure memory, you should use takeBytesToWriteSecure().

SecureArray QCA::QPipeEnd::takeBytesToWriteSecure | ( |  | ) |

Returns any unsent bytes queued for writing.

If the pipe is using insecure memory, you should use takeBytesToWrite().

void QCA::QPipeEnd::readyRead | ( |  | ) |
| signal

Emitted when there are bytes available to be read from the read end of the pipe.

See also
  bytesAvailable()

void QCA::QPipeEnd::bytesWritten | ( | int | bytes | ) |
| signal

Emitted when bytes have been written to the write end of the pipe.

Parameters

  bytes | the number of bytes written

void QCA::QPipeEnd::closed | ( |  | ) |
| signal

Emitted when this end of the pipe is closed as a result of calling close()

If this is the write end of the pipe and there is data still pending to write, this signal will be emitted once all of the data has been written.

To be notified if the other end of the pipe has been closed, see error().

void QCA::QPipeEnd::error | ( | QCA::QPipeEnd::Error | e | ) |
| signal

Emitted when the pipe encounters an error trying to read or write, or if the other end of the pipe has been closed.

Parameters

  e | the reason for error

The documentation for this class was generated from the following file:

- qpipe.h