# QCA::QPipeDevice Class Reference
[QCA user API]

Unbuffered direct pipe. More...

`#include <QtCrypto>`

Inheritance diagram for QCA::QPipeDevice:

Collaboration diagram for QCA::QPipeDevice:

[legend]

List of all members.

## Public Types

enum | Type { Read, Write }

## Signals

void | notify ()

## Public Member Functions

int | bytesAvailable () const
void | close ()
void | enable ()
Q_PIPE_ID | id () const
int | idAsInt () const
bool | isValid () const
| QPipeDevice (QObject *parent=0)
int | read (char *data, int maxsize)
void | release ()
bool | setInheritable (bool enabled)
void | take (Q_PIPE_ID id, Type t)
Type | type () const
int | write (const char *data, int size)
int | writeResult (int *written) const

## Friends

class | Private

## Detailed Description

Unbuffered direct pipe.

This class is not usually required except for very low level operations. You should use QPipe and QPipeEnd for most applications.

## Member Enumeration Documentation

enum QCA::QPipeDevice::Type

The type of device.

Enumerator:

  Read | The pipe end can be read from.
  Write | The pipe end can be written to.

## Constructor & Destructor Documentation

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

Standard constructor.

Parameters:

  | parent | the parent object to this object

## Member Function Documentation

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

Obtain the number of bytes available to be read.

void QCA::QPipeDevice::close | ( |  | ) |

Close the pipe end.

void QCA::QPipeDevice::enable | ( |  | ) |

Enable the pipe for reading or writing (depending on Type).

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

The low level identification for this pipe.

On Windows, this is a HANDLE. On Unix, this is a file descriptor (i.e. integer).

Code using this method should be carefully tested for portability.

See also:
  idAsInt

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

The low level identification for this pipe, returned as an integer.

Code using this method should be carefully tested for portability.

See also:
  id().

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

Test whether this object corresponds to a valid pipe.

void QCA::QPipeDevice::notify | ( |  | ) | `[signal]`

Emitted when the pipe end can be read from or written to (depending on its Type).

int QCA::QPipeDevice::read | ( | char * | data,
|  | int | maxsize |
| ) |  |  |

Read from the pipe end.

Parameters:

  | data | where to put the data that has been read
  | maxsize | the maximum number of bytes to be read.

Returns:
  the actual number of bytes read, 0 on end-of-file, or -1 on error.

void QCA::QPipeDevice::release | ( |  | ) |

Release the pipe end, but do not close it.

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

Set the pipe end to be inheritable.

Note:
  On Windows, this operation changes the pipe end id value.

Parameters:

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

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

Take over an existing pipe id, closing the old pipe if any.

Parameters:

  | id | the identification of the pipe end to take over.
  | t | the type of pipe end (read or write).

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

The Type of the pipe device (that is, read or write).

int QCA::QPipeDevice::write | ( | const char * | data,
|  | int | size |
| ) |  |  |

Write to the pipe end.

Parameters:

  | data | the source of the data to be written
  | size | the number of bytes in the data to be written

Note:
  the data source must remain valid

Returns:
  the number of bytes written, or -1 on error.

int QCA::QPipeDevice::writeResult | ( | int * | written | ) | const

The result of a write operation.

Parameters:

  | written | if not null, this will be set to the number of bytes written in the last operation.

Returns:
  0 on success (all data written), or -1 on error

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

- qpipe.h