smtk::tty_color Class Reference

escape strings for terminal colors More...

Inheritance diagram for smtk::tty_color:

Inheritance graph
[legend]
List of all members.

Public Member Functions

const char * bld (void) const
 color bold
const char * blu (void) const
 color blue
bool check_color (void)
 check is escape colors are set
const char * end (void) const
 color end
void get_env_color (FILE *file, bool over_ride_env=false)
 parse environment variable SMTK_COLOR.
const char * grn (void) const
 color green
const char * rblu (void) const
 color reverse blue
const char * red (void) const
 color red
const char * rev (void) const
 color reverse
const char * rgrn (void) const
 color reverse green
const char * rred (void) const
 color reverse red
const char * rtur (void) const
 color reverse turquoise
const char * rvil (void) const
 color reverse violet
const char * ryel (void) const
 color reverse yellow
void set_color (bool on=true)
 enable/disable the escape color strings.
 tty_color (FILE *file=0, bool over_ride_env=false)
const char * tur (void) const
 color turquoise
const char * und (void) const
 color under line
const char * vil (void) const
 color violet
const char * yel (void) const
 color yellow

Detailed Description

escape strings for terminal colors

class tty_color tty_color.h smtk.h

The environment variable SMTK_COLOR affects the escape color sequences in the tty_color class. GNU `ls' uses a simular thing to colorize terminal text using the --color option. The following values of SMTK_COLOR can control the escape color sequences:


Constructor & Destructor Documentation

tty_color::tty_color ( FILE *  file = 0,
bool  over_ride_env = false 
)

Parameters:
file is used to check if the file is a tty terminal that will interpret the escape sequences.
over_ride_env if true the color strings will not depend on the environment variable SMTK_COLOR.


Member Function Documentation

const char* smtk::tty_color::bld ( void   )  const [inline]

color bold

Returns:
color termio escape string bold.

const char* smtk::tty_color::blu ( void   )  const [inline]

color blue

Returns:
color termio escape string blue.

bool smtk::tty_color::check_color ( void   )  [inline]

check is escape colors are set

Returns:
true if there are color escape strings set, and false if there are all null strings.

const char* smtk::tty_color::end ( void   )  const [inline]

color end

Returns:
color termio escape string to end the current color mode.

void tty_color::get_env_color ( FILE *  file,
bool  over_ride_env = false 
)

parse environment variable SMTK_COLOR.

See color_env for how the environment variable SMTK_COLOR effects this class.

Parameters:
file is used to check if the file is a tty terminal that will interpret the escape sequences.
over_ride_env if true the color strings will not depend on the environment variable SMTK_COLOR.

const char* smtk::tty_color::grn ( void   )  const [inline]

color green

Returns:
color termio escape string green.

const char* smtk::tty_color::rblu ( void   )  const [inline]

color reverse blue

Returns:
color termio escape string reverse blue.

const char* smtk::tty_color::red ( void   )  const [inline]

color red

Returns:
color termio escape string red.

const char* smtk::tty_color::rev ( void   )  const [inline]

color reverse

Returns:
color termio escape string reverse-video.

const char* smtk::tty_color::rgrn ( void   )  const [inline]

color reverse green

Returns:
color termio escape string reverse green.

const char* smtk::tty_color::rred ( void   )  const [inline]

color reverse red

Returns:
color termio escape string reverse red.

const char* smtk::tty_color::rtur ( void   )  const [inline]

color reverse turquoise

Returns:
color termio escape string reverse turquoise.

const char* smtk::tty_color::rvil ( void   )  const [inline]

color reverse violet

Returns:
color termio escape string reverse violet.

const char* smtk::tty_color::ryel ( void   )  const [inline]

color reverse yellow

Returns:
color termio escape string reverse yellow.

void tty_color::set_color ( bool  on = true  ) 

enable/disable the escape color strings.

To give the API user the control, this is not called in any part of the SmTk API, other than in this class in the constructor. The setting of escape color strings is also set in the constructor from the value of the environment variable SMTK_COLOR. This will over-ride that. See color_env in the spew class detailed description.

Parameters:
on If on is true the escape color strings are set, and if on is false all the escape color strings are set to empty strings.

Reimplemented in smtk::spew.

const char* smtk::tty_color::tur ( void   )  const [inline]

color turquoise

Returns:
color termio escape string turquoise.

const char* smtk::tty_color::und ( void   )  const [inline]

color under line

Returns:
color termio escape string under-line.

const char* smtk::tty_color::vil ( void   )  const [inline]

color violet

Returns:
color termio escape string violet.

const char* smtk::tty_color::yel ( void   )  const [inline]

color yellow

Returns:
color termio escape string yellow.


The documentation for this class was generated from the following files:
Generated on Sat Aug 11 22:25:58 2007 for Simulation Toolkit (SmTk) by  doxygen 1.5.2