Public Member Functions | Private Member Functions | Private Attributes | List of all members
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]

Public Member Functions

void disableRawCharReads ()
 This ensures char reads are read element by element (not byte by byte). More...
 
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). More...
 
 InputTextStream ()
 Connects the stream to an input device. More...
 
virtual ~InputTextStream ()
 
- Public Member Functions inherited from ecl::interfaces::BaseTextStream< Device >
 BaseTextStream ()
 
Device & device ()
 Provides access to the underlying output device. More...
 
const ecl::ErrorerrorStatus () const
 Enumeration indicating the exit status of the last read operation. More...
 
bool fail () const
 Denotes the status of the last device operation. More...
 
virtual ~BaseTextStream ()
 

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. More...
 

Private Attributes

bool raw_char_reads
 

Additional Inherited Members

- Protected Attributes inherited from ecl::interfaces::BaseTextStream< Device >
ecl::Error error
 
Device io_device
 

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 87 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 148 of file input_text_stream.hpp.

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

Definition at line 93 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 486 of file input_text_stream.hpp.

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 475 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 650 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 572 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 520 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 503 of file input_text_stream.hpp.

Member Data Documentation

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

Definition at line 120 of file input_text_stream.hpp.


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


xbot_driver
Author(s): Roc, wangpeng@droid.ac.cn
autogenerated on Sat Oct 10 2020 03:27:38