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

The base class for output streams that write to TextDisplay objects. More...

#include <TextDisplayStream.hpp>

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

Public Member Functions

 TextDisplayBaseStream (TextDisplayBasicStreambuf< Char, Traits > *tbuf)
 Makes an output stream that writes to the given display. More...
 
void clearDisplay ()
 Remove all text from the display and place the cursor in the upper left corner. More...
 
void clearTo (unsigned int c, unsigned int r)
 Clear text from the current cursor position to the given position, inclusive. More...
 
const std::shared_ptr< TextDisplay > & display () const
 Returns the output display. More...
 
void moveCursor (unsigned int c, unsigned int r)
 Moves the display's cursor to the given location. More...
 
void startLine ()
 Moves the cursor to the start of a line clearing text along the way. More...
 

Static Public Member Functions

static int xallocIndex ()
 Returns the index from xalloc(); needed by the stream manipulators. More...
 

Private Types

using base = std::basic_ostream< Char, Traits >
 

Private Attributes

TextDisplayBasicStreambuf< Char, Traits > * tdbb
 The buffer handling the output. More...
 

Static Private Attributes

static const int xidx = std::ios_base::xalloc()
 The value from xalloc() used for stream manipulators to identify this stream type. More...
 

Detailed Description

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

The base class for output streams that write to TextDisplay objects.

The stream manipulators made for text displays all work with this class so there isn't a need for multiple sets of the stream manipulators, and the manipulators do not need a run-time check for multiple stream types. This class can be used directly, but it is easier to use one of the derived classes.

Author
Jeff Jackowski
Examples:
clockLCD.cpp.

Definition at line 424 of file TextDisplayStream.hpp.

Member Typedef Documentation

◆ base

template<class Char = char, class Traits = std::char_traits<Char>>
using duds::hardware::display::TextDisplayBaseStream< Char, Traits >::base = std::basic_ostream<Char, Traits>
private

Definition at line 425 of file TextDisplayStream.hpp.

Constructor & Destructor Documentation

◆ TextDisplayBaseStream()

template<class Char = char, class Traits = std::char_traits<Char>>
duds::hardware::display::TextDisplayBaseStream< Char, Traits >::TextDisplayBaseStream ( TextDisplayBasicStreambuf< Char, Traits > *  tbuf)
inline

Makes an output stream that writes to the given display.

Parameters
tbufThe stream buffer that will handle output to the display.
Precondition
The display is initialzied and ready to accept data.

Definition at line 441 of file TextDisplayStream.hpp.

Member Function Documentation

◆ clearDisplay()

template<class Char = char, class Traits = std::char_traits<Char>>
void duds::hardware::display::TextDisplayBaseStream< Char, Traits >::clearDisplay ( )
inline

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

Definition at line 472 of file TextDisplayStream.hpp.

◆ clearTo()

template<class Char = char, class Traits = std::char_traits<Char>>
void duds::hardware::display::TextDisplayBaseStream< Char, Traits >::clearTo ( unsigned int  c,
unsigned int  r 
)
inline

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.

Definition at line 484 of file TextDisplayStream.hpp.

◆ display()

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

Returns the output display.

Definition at line 455 of file TextDisplayStream.hpp.

◆ moveCursor()

template<class Char = char, class Traits = std::char_traits<Char>>
void duds::hardware::display::TextDisplayBaseStream< Char, Traits >::moveCursor ( unsigned int  c,
unsigned int  r 
)
inline

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.

Definition at line 465 of file TextDisplayStream.hpp.

◆ startLine()

template<class Char = char, class Traits = std::char_traits<Char>>
void duds::hardware::display::TextDisplayBaseStream< Char, Traits >::startLine ( )
inline

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.

Definition at line 492 of file TextDisplayStream.hpp.

◆ xallocIndex()

template<class Char = char, class Traits = std::char_traits<Char>>
static int duds::hardware::display::TextDisplayBaseStream< Char, Traits >::xallocIndex ( )
inlinestatic

Returns the index from xalloc(); needed by the stream manipulators.

Definition at line 449 of file TextDisplayStream.hpp.

Member Data Documentation

◆ tdbb

template<class Char = char, class Traits = std::char_traits<Char>>
TextDisplayBasicStreambuf<Char, Traits>* duds::hardware::display::TextDisplayBaseStream< Char, Traits >::tdbb
private

The buffer handling the output.

Definition at line 429 of file TextDisplayStream.hpp.

◆ xidx

template<class Char = char, class Traits = std::char_traits<Char>>
const int duds::hardware::display::TextDisplayBaseStream< Char, Traits >::xidx = std::ios_base::xalloc()
staticprivate

The value from xalloc() used for stream manipulators to identify this stream type.

Needed for each template instantiation.

Definition at line 434 of file TextDisplayStream.hpp.


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