CARMA C++
carma::ui::rtd::Format Class Reference

Class to describe the layout of text within a cell. More...

#include <carma/ui/rtd/common/RtDisplay.h>

Public Member Functions

void dump ()
 Debugging dump on width/indent/length. More...
 
void fmt (const char *s)
 Interprets a string containing the format information. More...
 
 Format ()
 Constructor. More...
 
 Format (int width, int indent, int len)
 Constructor. More...
 
 Format (const Format &rhs)
 Constructor. More...
 
 Format (const char *s)
 Constructor. More...
 

Public Attributes

int indent
 Left indent to the start of text in characters. More...
 
int len
 Length of formatted text in characters. More...
 
int width
 Total width of the cell in characters. More...
 

Detailed Description

Class to describe the layout of text within a cell.

A text cell can contain any of the following:

  1. A dynamically formatted string with placement specified by its indent (findent) and its length (flen)
  2. A string of asterisks to replace the formatted string when its length exceeds flen
  3. An alternate constant string which will be centered on the formatted string
  4. A string to indicate invalid data, "?", that is centered on the cell (width)
  5. A string "NoHW" that is centered on the formatted string.
  6. Sting streams (strstream) are used to assemble text. When the Standard Template Library is universally available, its string class will be used.

The final cell output must be a fixed number of chars at a fixed indent, (len and indent). So when the cell is formed, we take the input indent and length (flen & findent), and do the arithmetic and the padding that accounts for the fact that the ALT strings can be longer than the dynamically formatted strings, to produce the final (len and indent).

A Text Cell

   |           ?           |
   |            12.34567   |
   |           123.45678   |
   |          ALT_TEXT_A   |
   |          ALT_TEXT_AB  |

| TinyALT |

   |<-findent->            |
   |           <-flen–>   |
   |<-indent->             |
   |          <—len—>  |
   |<----—width------—>|
 

Definition at line 216 of file RtDisplay.h.

Constructor & Destructor Documentation

carma::ui::rtd::Format::Format ( )
explicit

Constructor.

carma::ui::rtd::Format::Format ( int  width,
int  indent,
int  len 
)

Constructor.

Parameters
widththe total width of the cell
indentleft indent to start of dynamic text
lenlength of dynamic text
carma::ui::rtd::Format::Format ( const Format rhs)

Constructor.

Parameters
formatreference to a format
carma::ui::rtd::Format::Format ( const char *  s)
explicit

Constructor.

Parameters
stringthe width, indent and length as a decimal dot separated string, such as "11.2.8". Or as just the width, e.g.

Member Function Documentation

void carma::ui::rtd::Format::dump ( )

Debugging dump on width/indent/length.

void carma::ui::rtd::Format::fmt ( const char *  s)

Interprets a string containing the format information.

Member Data Documentation

int carma::ui::rtd::Format::indent

Left indent to the start of text in characters.

Definition at line 250 of file RtDisplay.h.

int carma::ui::rtd::Format::len

Length of formatted text in characters.

Definition at line 252 of file RtDisplay.h.

int carma::ui::rtd::Format::width

Total width of the cell in characters.

Definition at line 248 of file RtDisplay.h.


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