DUDS
Distributed Update of Data from Something
duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits > Class Template Reference

Moves output from an output stream to a TextDisplay one character at a time. More...

#include <TextDisplayStream.hpp>

Inheritance diagram for duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits >:
Collaboration diagram for duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits >:

Public Member Functions

 TextDisplayBasicStreambuf (const std::shared_ptr< TextDisplay > &d)
 Makes the stream buffer with a display for output. More...
 
virtual void clearDisplay ()
 Remove all text from the display and place the cursor in the upper left corner. More...
 
virtual void clearTo (unsigned int c, unsigned int r)
 Clear text from the current cursor position to the given position, inclusive. More...
 
virtual unsigned int column () const
 Returns the cursos's column position. More...
 
const std::shared_ptr< TextDisplay > & display () const
 Returns the output display. More...
 
virtual void moveCursor (unsigned int c, unsigned int r)
 Moves the display's cursor to the given location. More...
 
virtual unsigned int row () const
 Returns the cursos's row position. More...
 
virtual void startLine ()
 Moves the cursor to the start of a line clearing text along the way. More...
 

Protected Member Functions

virtual Traits::int_type overflow (typename Traits::int_type c=Traits::eof())
 Writes a character to the display. More...
 

Private Attributes

std::shared_ptr< TextDisplaydisp
 The display that will receive the output. More...
 

Detailed Description

template<class Char, class Traits = std::char_traits<Char>>
class duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits >

Moves output from an output stream to a TextDisplay one character at a time.

The characters from the stream are immediately sent to the display. This works well for HD44780 type displays since they need time to process the data and the implementation will relinquish hardware access between characters.

The way this class uses the functions in TextDisplay allows other code to output using TextDisplay directly and interchangeably with this class.

Author
Jeff Jackowski

Definition at line 33 of file TextDisplayStream.hpp.

Constructor & Destructor Documentation

◆ TextDisplayBasicStreambuf()

template<class Char, class Traits = std::char_traits<Char>>
duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits >::TextDisplayBasicStreambuf ( const std::shared_ptr< TextDisplay > &  d)
inline

Makes the stream buffer with a display for output.

Parameters
dThe display that will take the output.
Precondition
The display is initialzied and ready to accept data.

Definition at line 75 of file TextDisplayStream.hpp.

Member Function Documentation

◆ clearDisplay()

template<class Char, class Traits = std::char_traits<Char>>
virtual void duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits >::clearDisplay ( )
inlinevirtual

Remove all text from the display and place the cursor in the upper left corner.

Reimplemented in duds::hardware::display::TextDisplayBasicBufferedStreambuf< Char, Traits >.

Definition at line 110 of file TextDisplayStream.hpp.

Referenced by duds::hardware::display::clear(), and duds::hardware::display::TextDisplayBaseStream< Char, Traits >::clearDisplay().

◆ clearTo()

template<class Char, class Traits = std::char_traits<Char>>
virtual void duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits >::clearTo ( unsigned int  c,
unsigned int  r 
)
inlinevirtual

Clear text from the current cursor position to the given position, inclusive.

The cursor will be moved to the spot immediately after the given position.

Parameters
cThe end column.
rThe end row.
Exceptions
TextDisplayRangeErrorThe requested position is beyond the display's boundries.

Reimplemented in duds::hardware::display::TextDisplayBasicBufferedStreambuf< Char, Traits >.

Definition at line 122 of file TextDisplayStream.hpp.

Referenced by duds::hardware::display::TextDisplayBaseStream< Char, Traits >::clearTo().

◆ column()

template<class Char, class Traits = std::char_traits<Char>>
virtual unsigned int duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits >::column ( ) const
inlinevirtual

Returns the cursos's column position.

Reimplemented in duds::hardware::display::TextDisplayBasicBufferedStreambuf< Char, Traits >.

Definition at line 87 of file TextDisplayStream.hpp.

◆ display()

template<class Char, class Traits = std::char_traits<Char>>
const std::shared_ptr<TextDisplay>& duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits >::display ( ) const
inline

Returns the output display.

Definition at line 81 of file TextDisplayStream.hpp.

Referenced by duds::hardware::display::TextDisplayBaseStream< Char, Traits >::display().

◆ moveCursor()

template<class Char, class Traits = std::char_traits<Char>>
virtual void duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits >::moveCursor ( unsigned int  c,
unsigned int  r 
)
inlinevirtual

Moves the display's cursor to the given location.

Parameters
cThe destination column.
rThe destination row.
Exceptions
TextDisplayRangeErrorThe requested position is beyond the display's boundries.

Reimplemented in duds::hardware::display::TextDisplayBasicBufferedStreambuf< Char, Traits >.

Definition at line 103 of file TextDisplayStream.hpp.

Referenced by duds::hardware::display::TextDisplayBaseStream< Char, Traits >::moveCursor().

◆ overflow()

template<class Char, class Traits = std::char_traits<Char>>
virtual Traits::int_type duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits >::overflow ( typename Traits::int_type  c = Traits::eof())
inlineprotectedvirtual

Writes a character to the display.

Reimplemented in duds::hardware::display::TextDisplayBasicBufferedStreambuf< Char, Traits >.

Definition at line 42 of file TextDisplayStream.hpp.

◆ row()

template<class Char, class Traits = std::char_traits<Char>>
virtual unsigned int duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits >::row ( ) const
inlinevirtual

Returns the cursos's row position.

Reimplemented in duds::hardware::display::TextDisplayBasicBufferedStreambuf< Char, Traits >.

Definition at line 93 of file TextDisplayStream.hpp.

◆ startLine()

template<class Char, class Traits = std::char_traits<Char>>
virtual void duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits >::startLine ( )
inlinevirtual

Moves the cursor to the start of a line clearing text along the way.

If the cursor is already at the start of a line, it will not move and no text will be cleared.

Reimplemented in duds::hardware::display::TextDisplayBasicBufferedStreambuf< Char, Traits >.

Definition at line 130 of file TextDisplayStream.hpp.

Referenced by duds::hardware::display::TextDisplayBaseStream< Char, Traits >::startLine(), and duds::hardware::display::startLine().

Member Data Documentation

◆ disp

template<class Char, class Traits = std::char_traits<Char>>
std::shared_ptr<TextDisplay> duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits >::disp
private

The display that will receive the output.

Definition at line 37 of file TextDisplayStream.hpp.

Referenced by duds::hardware::display::TextDisplayBasicStreambuf< Char, Traits >::display().


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