CLI  2.9
Text Class Reference

Simple line user interface object. More...

#include <ui_text.h>

Inheritance diagram for Text:

Public Member Functions

 Text (const unsigned int UI_MaxLines, const unsigned int UI_MaxLineLength)
 Constructor. More...
 
virtual ~Text (void)
 Destructor. More...
 
virtual void PutString (const char *const STR_Out) const
 Output handler. More...
 
virtual void Beep (void) const
 Beep handler. More...
 
virtual void CleanScreen (void) const
 Clean screen. More...
 
virtual const bool WouldOutput (const OutputDevice &CLI_Device) const
 Stack overflow protection. More...
 
void Begin (TextIterator &it) const
 Retrieves a text head iterator. More...
 
const bool PageUp (TextIterator &it) const
 Moves iterator one page up. More...
 
const bool LineUp (TextIterator &it) const
 Moves iterator one line up. More...
 
const bool LineDown (TextIterator &it, const OutputDevice *const PCLI_Out) const
 Moves iterator one line down. More...
 
const bool PageDown (TextIterator &it, const OutputDevice *const PCLI_Out) const
 Moves iterator one page down. More...
 
void End (TextIterator &it, const OutputDevice *const PCLI_Out) const
 Retrieves a text end iterator. More...
 
void PrintPage (TextIterator &it, const OutputDevice &CLI_Out, const bool B_FillPageWithBlankLines) const
 Print out a page of text. More...
 
- Public Member Functions inherited from OutputDevice
const tk::String GetDebugName (void) const
 Debug name accessor. More...
 
const int UseInstance (const CallInfo &CLI_CallInfo)
 Ensures instance validity. More...
 
const int FreeInstance (const CallInfo &CLI_CallInfo)
 Releases the instance. More...
 
const int GetInstanceUsers (void) const
 Instance user count accessor. More...
 
const bool OpenUp (const CallInfo &CLI_CallInfo)
 Checks the device is opened. More...
 
const bool CloseDown (const CallInfo &CLI_CallInfo)
 Indicates the device the client does not need the device to opened anymore. More...
 
const int GetOpenUsers (void) const
 Open state user count accessor. More...
 
const OutputDeviceoperator<< (const std::string &STR_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const tk::String &STR_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const char *const STR_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const char C_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const KEY E_Key) const
 Output operator. More...
 
const OutputDeviceoperator<< (const uint8_t UI8_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const int16_t I16_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const uint16_t UI16_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const int32_t I32_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const uint32_t UI32_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const int64_t I64_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const uint64_t UI64_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const float F_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const double D_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const void *const PV_Out) const
 Output operator. More...
 
const OutputDeviceoperator<< (const IOEndl &CLI_IOEndl) const
 Output operator. More...
 
const ResourceString GetLastError (void) const
 Last error accessor. More...
 
virtual const ScreenInfo GetScreenInfo (void) const
 Screen info accessor. More...
 
- Public Member Functions inherited from Object
virtual ~Object (void)=0
 Pure virtual destructor. More...
 

Protected Member Functions

virtual const bool OpenDevice (void)
 Device opening handler. More...
 
virtual const bool CloseDevice (void)
 Device closure handler. More...
 
- Protected Member Functions inherited from OutputDevice
 OutputDevice (const char *const STR_DbgName, const bool B_AutoDelete)
 Constructor. More...
 
virtual ~OutputDevice (void)
 Destructor. More...
 
- Protected Member Functions inherited from Object
 Object (void)
 Default constructor only available to sub-classes. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from OutputDevice
static OutputDeviceGetNullDevice (void)
 Null device singleton. More...
 
static OutputDeviceGetStdOut (void)
 Standard output device singleton. More...
 
static OutputDeviceGetStdErr (void)
 Standard error device singleton. More...
 
- Protected Attributes inherited from OutputDevice
ResourceString m_cliLastError
 

Detailed Description

Simple line user interface object.

Definition at line 47 of file ui_text.h.

Constructor & Destructor Documentation

◆ Text()

Text::Text ( const unsigned int  UI_MaxLines,
const unsigned int  UI_MaxLineLength 
)
explicit

Constructor.

Parameters
UI_MaxLinesMaximum number of lines
UI_MaxLineLengthMaximum length of lines

Definition at line 38 of file ui_text.cpp.

◆ ~Text()

Text::~Text ( void  )
virtual

Destructor.

Definition at line 44 of file ui_text.cpp.

Member Function Documentation

◆ Beep()

void Text::Beep ( void  ) const
virtual

Beep handler.

Reimplemented from OutputDevice.

Definition at line 83 of file ui_text.cpp.

◆ Begin()

void Text::Begin ( TextIterator it) const

Retrieves a text head iterator.

Parameters
itCurrent iterator.

Definition at line 105 of file ui_text.cpp.

Referenced by LineUp(), Less::OnKey(), More::ResetToDefault(), and Less::ResetToDefault().

◆ CleanScreen()

void Text::CleanScreen ( void  ) const
virtual

Clean screen.

Reimplemented from OutputDevice.

Definition at line 88 of file ui_text.cpp.

◆ CloseDevice()

const bool Text::CloseDevice ( void  )
protectedvirtual

Device closure handler.

Returns
true for success, false otherwise.
Note
Devices have to be prepared to be called several times through this method. They should do the closure once only (unless they have been opened between CloseDevice() calls), and indicate no failure thereafter.

Implements OutputDevice.

Definition at line 53 of file ui_text.cpp.

◆ End()

void Text::End ( TextIterator it,
const OutputDevice *const  PCLI_Out 
) const

Retrieves a text end iterator.

Parameters
itCurrent iterator.
PCLI_OutOutput device, if the end of the text should be output by the way.

Definition at line 235 of file ui_text.cpp.

References LineDown().

Referenced by Less::OnKey().

◆ LineDown()

const bool Text::LineDown ( TextIterator it,
const OutputDevice *const  PCLI_Out 
) const

Moves iterator one line down.

Returns
true if the iterator has changed, false otherwise.
Parameters
itCurrent iterator.
PCLI_OutOutput device, if the bottom line should be output by the way.

Definition at line 177 of file ui_text.cpp.

References CLI_ASSERT, OutputDevice::GetNullDevice(), OutputDevice::ScreenInfo::GetSafeWidth(), and PrintPage().

Referenced by End(), More::OnKey(), Less::OnKey(), and PageDown().

◆ LineUp()

const bool Text::LineUp ( TextIterator it) const

Moves iterator one line up.

Returns
true if the iterator has changed, false otherwise.
Parameters
itCurrent iterator.

Definition at line 128 of file ui_text.cpp.

References Begin(), CLI_ASSERT, and OutputDevice::ScreenInfo::GetSafeWidth().

Referenced by Less::OnKey(), and PageUp().

◆ OpenDevice()

const bool Text::OpenDevice ( void  )
protectedvirtual

Device opening handler.

Returns
true for success, false otherwise.
Note
Devices have to be prepared to be called several times through this method. They should do the opening once only (unless they have been closed between OpendDevice() calls), and indicate no failure thereafter.

Implements OutputDevice.

Definition at line 48 of file ui_text.cpp.

◆ PageDown()

const bool Text::PageDown ( TextIterator it,
const OutputDevice *const  PCLI_Out 
) const

Moves iterator one page down.

Returns
true if the iterator has changed, false otherwise.
Parameters
itCurrent iterator.
PCLI_OutOutput device, if the page should be output by the way.

Definition at line 220 of file ui_text.cpp.

References LineDown().

Referenced by Less::OnKey(), and More::OnKey().

◆ PageUp()

const bool Text::PageUp ( TextIterator it) const

Moves iterator one page up.

Returns
true if the iterator has changed, false otherwise.
Parameters
itCurrent iterator.

Definition at line 113 of file ui_text.cpp.

References LineUp().

Referenced by Less::OnKey().

◆ PrintPage()

void Text::PrintPage ( TextIterator it,
const OutputDevice CLI_Out,
const bool  B_FillPageWithBlankLines 
) const

Print out a page of text.

Updates automatically the bottom position of the iterator one page below the top position.

Parameters
itIterator which top position is ready for a page display.
CLI_OutOutput device to use for display.
B_FillPageWithBlankLinestrue when incomplete pages should be filled with blank lines.

Definition at line 241 of file ui_text.cpp.

References endl.

Referenced by LineDown(), and More::ResetToDefault().

◆ PutString()

void Text::PutString ( const char *const  STR_Out) const
virtual

Output handler.

Parameters
STR_OutOutput string.

Implements OutputDevice.

Definition at line 58 of file ui_text.cpp.

References CLI_ASSERT.

◆ WouldOutput()

const bool Text::WouldOutput ( const OutputDevice CLI_Device) const
virtual

Stack overflow protection.

Parameters
CLI_DeviceOther device that the callee device should check it would output characters to.
Returns
true if the callee device would redirect characters to the given device for output.

Determines whether the current device would output the given device in any way. Default implementation checks whether CLI_Device is the self device.

Reimplemented from OutputDevice.

Definition at line 95 of file ui_text.cpp.

References OutputDevice::WouldOutput().


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