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 BufferedOutStream, VarExpander, TeeOutStream, NullOutStream, MD5, BlockOutStream, WinOutStream, and UnixOutStream.

Referenced by TeeOutStream::flush(), VarExpander::flush(), and Output::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 BufferedOutStream, VarExpander, TeeOutStream, and UnixOutStream.

Referenced by TeeOutStream::supportsANSI(), VarExpander::supportsANSI(), BufferedOutStream::supportsANSI(), and Output::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 BufferedOutStream, VarExpander, 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 BufferedOutStream, VarExpander, TeeOutStream, UnixOutStream, NullOutStream, MD5, BlockOutStream, and WinOutStream.

Referenced by BufferedOutStream::flush(), Output::format(), Output::print(), StreamPipe::proceed(), TeeOutStream::write(), OutStream::write(), BufferedOutStream::write(), VarExpander::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: