#include <stoutput.h>
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 StOutput & | operator<< (const StString &str) const |
StOutput & | operator<< (SmartTools::Color color) |
Private Member Functions | |
void | init () |
int | getWindowSize () |
Private Attributes | |
SmartTools::COutputType | outputType |
StString | backgroundColor |
StString | foregroundColor |
StString | normalColor |
winsize | window |
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.
StOutput::StOutput | ( | ) | [inline] |
StOutput::StOutput | ( | SmartTools::COutputType | type | ) |
void StOutput::carriageReturn | ( | bool | clearLine = true |
) |
Return carriage and enable to clear all lines in standard output or error streams depending on output type.
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.
void StOutput::init | ( | ) | [private] |
StOutput& StOutput::operator<< | ( | SmartTools::Color | color | ) | [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.
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.
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] |
StString StOutput::backgroundColor [private] |
StString StOutput::foregroundColor [private] |
StString StOutput::normalColor [private] |
SmartTools::COutputType StOutput::outputType [private] |
winsize StOutput::window [private] |