Console Class Reference

A class that provides basic control of the console, such as changing text attributes, clearing the screen, and moving the cursor. More...

#include <Console.h++>

List of all members.

Public Types

enum  TextColor {
  ColorBlack, ColorRed, ColorGreen, ColorYellow,
  ColorBlue, ColorMagenta, ColorCyan, ColorWhite
}
 

Text colors.

More...
enum  TextStyle { StyleBold, StyleUnderline, StyleInverse }
 

Text styles.

More...

Public Member Functions

 Console ()
 Construct a new Console object.
 ~Console ()
 Destructor.
size_t read (char *text, size_t maxlen)
 Read text from the console.
void write (const char *text, size_t len=0)
 Write text to the console.
bool setEcho (bool on)
 Enable or disable the echoing of input characters on the console.
void moveCursor (uint_t row, uint_t column)
 Move the cursor to a new position.
void clear ()
 Clear the console.
void setTextForeground (TextColor color)
 Set the foreground color for subsequent text.
void setTextBackground (TextColor color)
 Set the background color for subsequent text.
void beginTextStyle (TextStyle style)
 Turn on a text style for subsequent text.
void endTextStyle (TextStyle style)
 Turn off a text style for subsequent text.
void resetTextStyle ()
 Turn off all text styles for subsequent text.
void setTitle (const String &title)
 Set the title of the console window.
bool getSize (uint_t *columns, uint_t *rows)
 Get the size of the console, in rows and columns.

Detailed Description

A class that provides basic control of the console, such as changing text attributes, clearing the screen, and moving the cursor.

Author:
Mark Lindner

Member Enumeration Documentation

enum TextColor

Text colors.

Enumerator:
ColorBlack 
ColorRed 
ColorGreen 
ColorYellow 
ColorBlue 
ColorMagenta 
ColorCyan 
ColorWhite 
enum TextStyle

Text styles.

Enumerator:
StyleBold 
StyleUnderline 
StyleInverse 

Constructor & Destructor Documentation

Console (  ) 

Construct a new Console object.

~Console (  ) 

Destructor.


Member Function Documentation

void beginTextStyle ( TextStyle  style  ) 

Turn on a text style for subsequent text.

Parameters:
style The style to turn on.
void clear (  ) 

Clear the console.

void endTextStyle ( TextStyle  style  ) 

Turn off a text style for subsequent text.

Parameters:
style The style to turn off.
bool getSize ( uint_t columns,
uint_t rows 
)

Get the size of the console, in rows and columns.

Parameters:
columns A pointer to the value in which to store the number of columns. May be NULL.
rows A pointer to the value in which to store the number of rows. May be NULL.
Returns:
true on success, false if the size could not be determined.
void moveCursor ( uint_t  row,
uint_t  column 
)

Move the cursor to a new position.

If the specified position is not valid, the cursor is not moved.

Parameters:
row The new row.
column The new column.
size_t read ( char *  text,
size_t  maxlen 
)

Read text from the console.

Parameters:
text The array of characters to read into. The array will always be NUL-terminated on return.
maxlen The maximum number of characters to read.
Returns:
The number of characters actually read.
void resetTextStyle (  ) 

Turn off all text styles for subsequent text.

bool setEcho ( bool  on  ) 

Enable or disable the echoing of input characters on the console.

Returns:
true on success, false otherwise.
void setTextBackground ( TextColor  color  ) 

Set the background color for subsequent text.

Parameters:
color The text color.
void setTextForeground ( TextColor  color  ) 

Set the foreground color for subsequent text.

Parameters:
color The text color.
void setTitle ( const String title  ) 

Set the title of the console window.

Parameters:
title The new title.
void write ( const char *  text,
size_t  len = 0 
)

Write text to the console.

Parameters:
text The array of characters to write.
len The number of characters to write, or 0 to write all characters in the array, up to a NUL.

The documentation for this class was generated from the following files:
Generated on Sat Nov 26 16:49:08 2011 for libcommonc++ by  doxygen 1.6.3