Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
ecl::interfaces::InputTextStream< Device, true > Class Template Reference

Input text stream interface. More...

#include <input_text_stream.hpp>

Inheritance diagram for ecl::interfaces::InputTextStream< Device, true >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void disableRawCharReads ()
 This ensures char reads are read element by element (not byte by byte).
 InputTextStream ()
 Connects the stream to an input device.
virtual ~InputTextStream ()

Public Attributes

InputTextStream< Device >
&operator>>(char &c)
ecl_assert_throw_decl(ecl
InputTextStream< Device >
&operator>>(std::string &s)
ecl_assert_throw_decl(ecl
InputTextStream< Device >
&operator>>(short &i)
ecl_assert_throw_decl(ecl
InputTextStream< Device >
&operator>>(int &i)
ecl_assert_throw_decl(ecl
InputTextStream< Device >
&operator>>(long &i)
ecl_assert_throw_decl(ecl
InputTextStream< Device >
&operator>>(unsigned char &c)
ecl_assert_throw_decl(ecl
InputTextStream< Device >
&operator>>(unsigned short &i)
ecl_assert_throw_decl(ecl
InputTextStream< Device >
&operator>>(unsigned int &i)
ecl_assert_throw_decl(ecl
InputTextStream< Device >
&operator>>(unsigned long &i)
ecl_assert_throw_decl(ecl
InputTextStream< Device >
&operator>>(float &f)
ecl_assert_throw_decl(ecl
InputTextStream< Device >
&operator>>(double &d)
ecl_assert_throw_decl(ecl
InputTextStream< Device >
&operator>>(long long &i)
ecl_assert_throw_decl(ecl
InputTextStream< Device >
&operator>>(unsigned long
long &i) ecl_assert_throw_decl(ecl
InputTextStream< Device >
&operator>>(bool &b)
ecl_assert_throw_decl(ecl void 
enableRawCharReads ()
 This permits true char by char reads (including space and newline chars).

Private Member Functions

template<typename Number >
bool getFloatFromStream (Number &f)
template<typename Number >
bool getIntegerFromStream (Number &i)
template<typename Number >
bool parseHexInteger (Number &i)
bool skipLeadingWhiteSpace (char &c)
 Private implementation that churns through any leading white space.

Private Attributes

bool raw_char_reads

Detailed Description

template<typename Device>
class ecl::interfaces::InputTextStream< Device, true >

Input text stream interface.

Defines the appropriate functionality required for input text streams.

Template Parameters:
Device: this must be a class that satisfies the input device concept (refer to the documentation in ecl_concepts for details).

Usage:

 TextStream<IFile> ifstream;
 ifstream.device().open("dudes.txt");
 char c;
 ifstream >> c;

Some notes - text streams support reading by one of three methods:

Definition at line 86 of file input_text_stream.hpp.


Constructor & Destructor Documentation

template<typename Device >
ecl::interfaces::InputTextStream< Device, true >::InputTextStream ( )

Connects the stream to an input device.

Connects the text stream to the associated input device. Use the device() handle to properly open the device, e.g.

 InputTextStream<IFile> ifstream;

Definition at line 147 of file input_text_stream.hpp.

template<typename Device >
virtual ecl::interfaces::InputTextStream< Device, true >::~InputTextStream ( ) [inline, virtual]

Definition at line 92 of file input_text_stream.hpp.


Member Function Documentation

template<typename Device >
void ecl::interfaces::InputTextStream< Device, true >::disableRawCharReads ( )

This ensures char reads are read element by element (not byte by byte).

This has the opposite functionality to enableRawCharReads(). See that method for more information.

See also:
enableRawCharReads().

Definition at line 485 of file input_text_stream.hpp.

template<typename Device >
template<typename Number >
bool ecl::interfaces::InputTextStream< Device, true >::getFloatFromStream ( Number &  f) [private]

Definition at line 649 of file input_text_stream.hpp.

template<typename Device >
template<typename Number >
bool ecl::interfaces::InputTextStream< Device, true >::getIntegerFromStream ( Number &  i) [private]

Parses a value from a stream into an integral type.

Parameters:
i: the integral type variable to stream the value into.

Definition at line 571 of file input_text_stream.hpp.

template<typename Device >
template<typename Number >
bool ecl::interfaces::InputTextStream< Device, true >::parseHexInteger ( Number &  i) [private]

Parses a hex number from a stream into an integral type.

Parameters:
i: the integer to stream the value to.

Definition at line 519 of file input_text_stream.hpp.

template<typename Device >
bool ecl::interfaces::InputTextStream< Device, true >::skipLeadingWhiteSpace ( char &  c) [private]

Private implementation that churns through any leading white space.

This checks for leading space and newline characters. If successful, it returns the first read character in its argument.

Parameters:
c: if successful, the first legitimate character is returned here.
Returns:
bool : true if successful, false otherwise.

Definition at line 502 of file input_text_stream.hpp.


Member Data Documentation

template<typename Device >
void ecl::interfaces::InputTextStream< Device, true >::enableRawCharReads

This permits true char by char reads (including space and newline chars).

By default, text streams read chars (via the operator>> (char &c)) method in the same way as every other operator is used, that is, element by element. As a result, any leading whitespace or newline characters are ignored. By calling this function, you can disable this functionality (for the operator>> (char&c) method only) so true byte by byte reads can be performed. This is usually only useful for things like serial devices - not so much for files or standard input style devices.

See also:
disableRawCharReads().

Definition at line 115 of file input_text_stream.hpp.

template<typename Device >
bool ecl::interfaces::InputTextStream< Device, true >::raw_char_reads [private]

Definition at line 119 of file input_text_stream.hpp.


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


ecl_streams
Author(s): Daniel Stonier (d.stonier@gmail.com)
autogenerated on Thu Jan 2 2014 11:12:54