Qt Cryptographic Architecture: QCA::QPipeEnd Class Reference

Qt Cryptographic Architecture

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

## ◆ Error

enum QCA::QPipeEnd::Error

The type of error.

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

## Constructor & Destructor Documentation

## ◆ QPipeEnd()

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

Standard constructor.

Parameters

  parent | the parent object for this object

## Member Function Documentation

## ◆ reset()

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

Reset the pipe end to an inactive state.

## ◆ type()

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

The type of pipe end (either read or write)

## ◆ isValid()

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

## ◆ id()

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

Pipe identification.

## ◆ idAsInt()

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

Pipe identification.

## ◆ take()

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)

## ◆ setSecurityEnabled()

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).

## ◆ enable()

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.

## ◆ close()

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

Close the end of the pipe.

See also
  closed()

## ◆ release()

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.

## ◆ setInheritable()

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).

## ◆ finalize()

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

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

## ◆ finalizeAndRelease()

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

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

## ◆ bytesAvailable()

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.

## ◆ bytesToWrite()

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

## ◆ read()

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).

## ◆ write()

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

## ◆ readSecure()

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).

## ◆ writeSecure()

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

## ◆ takeBytesToWrite()

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

Returns any unsent bytes queued for writing.

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

## ◆ takeBytesToWriteSecure()

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

Returns any unsent bytes queued for writing.

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

## ◆ readyRead

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

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

See also
  bytesAvailable()

## ◆ bytesWritten

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

## ◆ closed

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().

## ◆ 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