QIODevice Class Reference


The QIODevice class is the base class of IO devices. (details) (complete member list)

#include <qiodev.h>

Inherited by QBuffer and QFile.

Public Members

Protected Members


Detailed Description

The QIODevice class is the base class of IO devices.

An IO device represents a medium that one can read bytes from and write bytes to. The QIODevice class itself is not capable of reading or writing any data, but it has virtual functions for doing so. These functions are implemented by the subclasses QFile, QBuffer etc.

There are two types of IO devices; direct access or sequential access devices. Files can normally be accessed directly, except stdin etc., which must be processed sequentially. Buffers are always direct access devices.

The access mode of an IO device can be either raw or buffered. QFile objects can be creating using one of these. Raw access mode is more low level, while buffered access use smart buffering techniques. The raw access mode is best when IO is block-operated using 4kB block size or greater. Buffered access works better when reading small portions of data at a time.

An IO device operation can be executed in either synchronous or asynchronous mode. The IO devices currently supported by Qt only execute synchronously.

See also: QDataStream, QTextStream, QTSManip.


Member Function Documentation

QIODevice::QIODevice ()

Constructs an IO device.

QIODevice::~QIODevice ()

Destroys an IO device.

long QIODevice::at () const

Virtual function that returns the current IO device index.

This index is the data read/write head of the IO device.

bool QIODevice::at (long n)

Virtual function that sets the IO device index to n.

bool QIODevice::atEnd () const

Virtual function that returns TRUE if the IO device index is at the end of the input.

int QIODevice::flags () const

Returns the current IO device flags setting.

Flags consists of mode flags and state flags.

See also: mode() and state().

int QIODevice::mode () const

Returns bits OR'ed together that specify the current operation mode.

These are the flags that were given to the open() function.

The flags are: IO_ReadOnly, IO_WriteOnly, IO_ReadWrite, IO_Append, IO_Translate, IO_Truncate.

int QIODevice::readLine (char *data, uint maxlen)

Reads a line of text, maximum maxlen bytes.

This virtual function can be reimplemented by subclasses.

void QIODevice::setMode (int m)

Internal, used by subclasses to set the device mode.

void QIODevice::setState (int s)

Internal, used by subclasses to set the device state.

void QIODevice::setStatus (int s)

Internal, used by subclasses to set the device status (not state).

void QIODevice::setType (int t)

Internal, used by subclasses to set the device type.

int QIODevice::state () const

Returns bits OR'ed together that specify the current state.

The flags are: IO_Open.

Subclasses may define more flags.


This file is part of the Qt toolkit, copyright 1995 Troll Tech, all rights reserved.

It was generated from the following files:


Generated at 16:17, 1995/06/30 by the webmaster at Troll Tech