StOutput Class Reference

StOutput enables programs to write text with background and foreground colors. More...

#include <stoutput.h>

List of all members.

Public Member Functions

 StOutput ()
 StOutput (SmartTools::COutputType type)
void setBackgroundColor (SmartTools::Color color)
void setForegroundColor (SmartTools::Color color)
void setDefaultForegroundColor (SmartTools::Color color)
void setOutput (SmartTools::COutputType type)
void clearColors ()
void clearBackgroundColor ()
void clearForegroundColor ()
void clearNormalColor ()
void print (const StString &str) const
void printError (const StString &str) const
void printNormal (const StString &str) const
void println (const StString &str, bool paintWholeLine=false)
void carriageReturn (bool clearLine=true)
void flush () const
const StOutputoperator<< (const StString &str) const
StOutputoperator<< (SmartTools::Color color)

Private Member Functions

void init ()
int getWindowSize ()

Private Attributes

SmartTools::COutputType outputType
StString backgroundColor
StString foregroundColor
StString normalColor
winsize window


Detailed Description

StOutput enables programs to write text with background and foreground colors.

It works just like cout from the C++ std library, but it has added support for colors. It can write text with given foreground and background colors, with the option to paint the whole line with the background color.


Constructor & Destructor Documentation

StOutput::StOutput (  )  [inline]

StOutput::StOutput ( SmartTools::COutputType  type  ) 


Member Function Documentation

void StOutput::carriageReturn ( bool  clearLine = true  ) 

Return carriage and enable to clear all lines in standard output or error streams depending on output type.

Parameters:
clearLine clear all lines.

void StOutput::clearBackgroundColor (  )  [inline]

void StOutput::clearColors (  )  [inline]

Reset colors to default value

void StOutput::clearForegroundColor (  )  [inline]

void StOutput::clearNormalColor (  )  [inline]

void StOutput::flush (  )  const [inline]

Flush the output buffer.

int StOutput::getWindowSize (  )  [private]

It is used to paint or clear all lines.

Returns:
window size

void StOutput::init (  )  [private]

StOutput& StOutput::operator<< ( SmartTools::Color  color  )  [inline]

const StOutput& StOutput::operator<< ( const StString str  )  const [inline]

void StOutput::print ( const StString str  )  const

If the type is Out_Error, use the printError function for output. Otherwise, use printNormal.

void StOutput::printError ( const StString str  )  const

Print str to the standard error stream.

Note:
The usual destination of stderr is the text terminal, but you can redirect it to a file like this: program 2> file.

void StOutput::println ( const StString str,
bool  paintWholeLine = false 
)

Prints the text and puts endl at the end. It can also paint the whole line.

void StOutput::printNormal ( const StString str  )  const

Print str to the standard output stream.

Note:
The usual destination is the text terminal, but you can redirect it to a file like this: program > file.

void StOutput::setBackgroundColor ( SmartTools::Color  color  ) 

void StOutput::setDefaultForegroundColor ( SmartTools::Color  color  ) 

void StOutput::setForegroundColor ( SmartTools::Color  color  ) 

void StOutput::setOutput ( SmartTools::COutputType  type  )  [inline]


Member Data Documentation

StString StOutput::backgroundColor [private]

StString StOutput::foregroundColor [private]

StString StOutput::normalColor [private]

SmartTools::COutputType StOutput::outputType [private]

winsize StOutput::window [private]


The documentation for this class was generated from the following files:
Generated on Tue Nov 14 21:15:09 2006 for Smart Tools Library by  doxygen 1.4.7