Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
InStream Class Referenceabstract

#include <elm/io/InStream.h>

+ Inheritance diagram for InStream:

Public Member Functions

virtual ~InStream (void)
 
virtual int read (void *buffer, int size)=0
 
virtual int read (void)
 
virtual CString lastErrorMessage (void)
 

Static Public Attributes

static const int FAILED = -1
 
static const int ENDED = -2
 
static InStreamnull = _null
 

Detailed Description

This class must be shared by all classes implementing input streams. It provides common facilities provided by input streams.

Constructor & Destructor Documentation

◆ ~InStream()

~InStream ( void  )
inlinevirtual

Common virtual destructor.

Member Function Documentation

◆ lastErrorMessage()

CString lastErrorMessage ( void  )
virtual

Return a message for the last error.

Returns
Message of the last error.

Reimplemented in UnixInStream, and WinInStream.

Referenced by StreamPipe::lastErrorMessage().

◆ read() [1/2]

int read ( void buffer,
int  size 
)
pure virtual

Read some bytes from the stream and store them in the given buffer. This method does not ever read as many bytes as available in the buffer even if the stream is not ended. Insteadn a read returning 0 bytes means the end of stream is reached.

Parameters
bufferBuffer to write bytes in.
sizeSize of the buffer.
Returns
Number of read bytes, 0 for end of stream, -1 for an error.

Implemented in BlockInStream, BufferedInStream, NullInStream, UnixInStream, and WinInStream.

Referenced by StreamPipe::proceed().

◆ read() [2/2]

int read ( void  )
virtual

Read one byte from the stream.

Returns
Read byte, FAILED for an error, ENDED for end of stream.

Reimplemented in BufferedInStream, UnixInStream, WinInStream, and BlockInStream.

References InStream::ENDED, and InStream::FAILED.

Referenced by WinInStream::read(), and UnixInStream::read().

Member Data Documentation

◆ ENDED

◆ FAILED

◆ null

InStream & null = _null
static

An input stream that is always at end.


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