Public Member Functions
ecl::TextStream< Device > Class Template Reference

A text streaming interface. More...

#include <text_stream.hpp>

Inheritance diagram for ecl::TextStream< Device >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~TextStream ()

Detailed Description

template<typename Device>
class ecl::TextStream< Device >

A text streaming interface.

This connects to an underlying device and enables text streaming to and from the device. The device type (determined by input and output device concept checks) determines the type of interface that is brought into the textstream instance, either input, output or both.

Usage:

Instantiating

To open the underlying device,

 TextStream<OFile> ofstream;
 ofstream.device().open("dudes.txt",New);

Streaming

Usage follows very similar to the standard c++ streams.

 ofstream << "dudes " << 32.36;
 ofstream.flush();

Formatting

These streams are usable with the format classes in ecl_formatters.

 Format<double> format; format.width(5); format.precision(2);
 double d = 1.0/3.0;
 ostream << format(d);  // This will send 0.33 to the stream.
 ostream.flush();

Error Checking

Output streams can generate errors that are not so easily checked compared with handling devices directly. To check for failure, ecl streams use a mechanism similar to that of the standard cout stream.

 ostream << 32.1;
 if ( ostream.fail() ) {
     std::cout << ostream.errorMessage() << std::endl;
 }

You can also use the errorStatus() method to retrieve the exact error flag (enumeration).

See also:
interfaces::InputTextStream<Device,true>, interfaces::OutputTextStream<Device,true>, interfaces::BaseTextStream.

Definition at line 94 of file text_stream.hpp.


Constructor & Destructor Documentation

template<typename Device>
virtual ecl::TextStream< Device >::~TextStream ( ) [inline, virtual]

Definition at line 97 of file text_stream.hpp.


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


ecl_streams
Author(s): Daniel Stonier
autogenerated on Wed Aug 26 2015 11:27:40