Om
Public Member Functions | Private Types | Private Attributes | List of all members
Om::Source::StreamSource< ThisItem > Class Template Reference

A Source adapter for an input stream. More...

#include "stream_source.hpp"

+ Inheritance diagram for Om::Source::StreamSource< ThisItem >:
+ Collaboration diagram for Om::Source::StreamSource< ThisItem >:

Public Member Functions

 StreamSource ()
 
 StreamSource (std::istream &)
 
StreamSourceoperator= (StreamSource)
 
virtual bool operator! () const
 
virtual ThisItem const & operator* () const
 
bool Equals (StreamSource const &) const
 
virtual void Pop ()
 Pops the current item. More...
 
void Swap (StreamSource &)
 
- Public Member Functions inherited from Om::Source::DefaultSource< char const, StreamSource< char > >
virtual ~DefaultSource ()=0
 
StreamSource< char > & operator++ ()
 Pulls the next item from the Source. More...
 
StreamSource< char > operator++ (int)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
 
virtual bool Equals (Source< char const > const &) const
 
bool Equals (StreamSource< char > const &) const
 
- Public Member Functions inherited from Om::Source::Source< ThisItem >
virtual ~Source ()=0
 
ThisItem * operator-> () const
 
 operator Boolean () const
 Implements the Safe Boolean idiom. More...
 
virtual bool Equals (Source const &) const =0
 

Private Types

typedef std::istreambuf_iterator< ThisItem > StreamIterator
 

Private Attributes

StreamIterator thisStreamIterator
 
boost::optional< ThisItem > thisItem
 The current item. More...
 

Additional Inherited Members

- Public Types inherited from Om::Source::Source< ThisItem >
typedef void(Source::* Boolean) () const
 The implementation of the Safe Boolean idiom. More...
 

Detailed Description

template<typename ThisItem = char>
class Om::Source::StreamSource< ThisItem >

Note
Const methods are not thread-safe due to a non-mutexed mutable member.
Dereferencing exposes a reference to a cache of the current item. Modifying the item will not modify the source data.

Definition at line 43 of file stream_source.hpp.

Member Typedef Documentation

◆ StreamIterator

template<typename ThisItem = char>
typedef std::istreambuf_iterator<ThisItem> Om::Source::StreamSource< ThisItem >::StreamIterator
private

Definition at line 74 of file stream_source.hpp.

Constructor & Destructor Documentation

◆ StreamSource() [1/2]

template<typename ThisItem = char>
Om::Source::StreamSource< ThisItem >::StreamSource ( )

◆ StreamSource() [2/2]

template<typename ThisItem = char>
Om::Source::StreamSource< ThisItem >::StreamSource ( std::istream &  )
explicit

Member Function Documentation

◆ operator=()

template<typename ThisItem = char>
StreamSource& Om::Source::StreamSource< ThisItem >::operator= ( StreamSource< ThisItem >  )

◆ operator!()

template<typename ThisItem = char>
virtual bool Om::Source::StreamSource< ThisItem >::operator! ( ) const
virtual
Returns
True if empty.

Implements Om::Source::Source< ThisItem >.

◆ operator*()

template<typename ThisItem = char>
virtual ThisItem const& Om::Source::StreamSource< ThisItem >::operator* ( ) const
virtual

◆ Equals()

template<typename ThisItem = char>
bool Om::Source::StreamSource< ThisItem >::Equals ( StreamSource< ThisItem > const &  ) const

◆ Pop()

template<typename ThisItem = char>
virtual void Om::Source::StreamSource< ThisItem >::Pop ( )
virtual
Precondition
Not empty.

Implements Om::Source::Source< ThisItem >.

◆ Swap()

template<typename ThisItem = char>
void Om::Source::StreamSource< ThisItem >::Swap ( StreamSource< ThisItem > &  )

Member Data Documentation

◆ thisStreamIterator

template<typename ThisItem = char>
StreamIterator Om::Source::StreamSource< ThisItem >::thisStreamIterator
private

Definition at line 78 of file stream_source.hpp.

◆ thisItem

template<typename ThisItem = char>
boost::optional<ThisItem> Om::Source::StreamSource< ThisItem >::thisItem
mutableprivate

Definition at line 84 of file stream_source.hpp.


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