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

#include <elm/io/OutStream.h>

+ Inheritance diagram for OutStream:

Public Member Functions

virtual ~OutStream (void)
 
virtual int write (const char *buffer, int size)=0
 
virtual int write (char byte)
 
virtual int flush (void)=0
 
virtual CString lastErrorMessage (void)
 
virtual bool supportsANSI () const
 

Static Public Attributes

static OutStreamnull = _null
 

Detailed Description

An output stream streams transfer a flow of bytes to another entity. It is an abstract interface that must be implemented by standard IO, files, pipes, compressors and so on.

Constructor & Destructor Documentation

◆ ~OutStream()

virtual ~OutStream ( void  )
inlinevirtual

Member Function Documentation

◆ flush()

int flush ( void  )
pure virtual

Cause the current stream to dump its buffer to the medium.

Returns
0 for success, less than 0 for error.

Implemented in VarExpander, TeeOutStream, BufferedOutStream, NullOutStream, WinOutStream, BlockOutStream, MD5, and UnixOutStream.

Referenced by Output::flush(), TeeOutStream::flush(), and VarExpander::flush().

◆ lastErrorMessage()

CString lastErrorMessage ( void  )
virtual

◆ supportsANSI()

bool supportsANSI ( ) const
virtual

Test if the current stream knows how to decode ANSI special codes. The default implementation returns false.

Returns
True if ANSI code are supported, false else.

Reimplemented in VarExpander, UnixOutStream, TeeOutStream, and BufferedOutStream.

Referenced by Output::supportsANSI(), BufferedOutStream::supportsANSI(), TeeOutStream::supportsANSI(), and VarExpander::supportsANSI().

◆ write() [1/2]

int write ( char  byte)
virtual

Write a byte to the stream.

Parameters
byteByte to write.
Returns
1 for success or less than 0 for an error.

Reimplemented in VarExpander, BufferedOutStream, and BlockOutStream.

References elm::io::byte(), and OutStream::write().

◆ write() [2/2]

int write ( const char *  buffer,
int  size 
)
pure virtual

This is the main method of an output stream: the given buffer is put on the stream.

Parameters
bufferByte buffer to write.
sizeSize of the byte buffer.
Returns
Number of transferred bytes or less than 0 for an error.

Implemented in VarExpander, UnixOutStream, TeeOutStream, BufferedOutStream, NullOutStream, WinOutStream, BlockOutStream, and MD5.

Referenced by BufferedOutStream::flush(), Output::format(), Output::print(), StreamPipe::proceed(), OutStream::write(), VarExpander::write(), BufferedOutStream::write(), TeeOutStream::write(), and Serializer::writeRaw().

Member Data Documentation

◆ null

OutStream & null = _null
static

Provides an output stream that does nothing.


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