NIODevice Class Reference

NIODevice class is the base class for working with IO devices. More...

Inheritance diagram for NIODevice:

NObject NAbstractSocket NFile NTcpSocket NTcpSocket

List of all members.

Public Types

enum  Mode {
  NotOpen = 1, ReadOnly = 2, ReadWrite = 4, Append = 8,
  Truncate = 16
}
 Enumerates file opening modes. More...

Public Member Functions

 NIODevice (void)
 Constructs a NIODevice object.
virtual ~NIODevice ()
 Destroys a NIODevice object.
virtual void open (Mode mode)=0
 Opens an associated device.
virtual void closeDevice (void)=0
 Closes an associated device.
void setReadBufferSize (nuint32 size)
 Sets the max size of the buffer used for reading data.
nuint32 getReadBufferSize (void) const
 Gets the max size of the buffer used for reading data.
virtual nint32 read (NDataStream *buffer)=0
 Reads data from the device.
virtual nint32 read (NDataStream *buffer, nuint32 bytes)=0
 Reads data from the device.
virtual nint32 readLine (NDataStream *buffer)=0
 Reads a line from the device.
virtual nint32 write (const NDataStream &data, nuint32 bytes=0)=0
 Writes data to the device.

Protected Attributes

nuint32 m_readBufferSize


Detailed Description

NIODevice class is the base class for working with IO devices.

Definition at line 37 of file niodevice.h.


Member Enumeration Documentation

enum Mode

Enumerates file opening modes.

Todo:
Change to upper case
Enumerator:
NotOpen  Not open
ReadOnly  Read Only
ReadWrite  Read write
Append  Append
Truncate  Truncate

Definition at line 43 of file niodevice.h.


Member Function Documentation

virtual void open ( Mode  mode  )  [pure virtual]

Opens an associated device.

Parameters:
mode Open mode as defined by enum Mode

Implemented in NFile, and NAbstractSocket.

Referenced by NAbstractSocket::open().

void setReadBufferSize ( nuint32  size  ) 

Sets the max size of the buffer used for reading data.

Parameters:
size The size, in bytes, for the buffer

Definition at line 34 of file niodevice.cpp.

References m_readBufferSize.

nuint32 getReadBufferSize ( void   )  const

Gets the max size of the buffer used for reading data.

Returns:
The buffer size

Definition at line 39 of file niodevice.cpp.

References m_readBufferSize.

virtual nint32 read ( NDataStream buffer  )  [pure virtual]

Reads data from the device.

Parameters:
buffer Output buffer for the bytes read
Returns:
The number of bytes read

Implemented in NFile, NTcpSocket, NAbstractSocket, and NTcpSocket.

virtual nint32 read ( NDataStream buffer,
nuint32  bytes 
) [pure virtual]

Reads data from the device.

Parameters:
buffer Output buffer for the bytes read
bytes Number of bytes to be read from the device.
Returns:
The number of bytes read

Implemented in NFile, NTcpSocket, NAbstractSocket, and NTcpSocket.

virtual nint32 readLine ( NDataStream buffer  )  [pure virtual]

Reads a line from the device.

Parameters:
buffer Output buffer for the bytes read
Returns:
The number of bytes read

Implemented in NFile, NTcpSocket, NAbstractSocket, and NTcpSocket.

virtual nint32 write ( const NDataStream data,
nuint32  bytes = 0 
) [pure virtual]

Writes data to the device.

Parameters:
data Data to be written to the device
bytes Amount of bytes to be written to the device. 0 means that all bytes of data will be written
Returns:
The number of bytes read

Implemented in NFile, NTcpSocket, NAbstractSocket, and NTcpSocket.


Member Data Documentation

nuint32 m_readBufferSize [protected]

Size of the read buffer

Definition at line 117 of file niodevice.h.

Referenced by getReadBufferSize(), NTcpSocket::read(), NFile::read(), and setReadBufferSize().


The documentation for this class was generated from the following files:
Generated on Wed Mar 5 23:10:36 2008 for NemesisUtilitiesSystem by  doxygen 1.5.4