Console Class Reference

The core console input/output class. More...

#include <console.h>

Inheritance diagram for Console:

CoreIOWriter CoreIOReader

List of all members.

Public Types

enum  ColourTypes { ,
  FG_GREEN = 0x0002, FG_RED = 0x0004, FG_INTENSITY = 0x0008, BG_BLUE = 0x0010,
  BG_GREEN = 0x0020, BG_RED = 0x0040, BG_INTENSITY = 0x0080
}
 Flags used for describing console colour output. More...

Public Member Functions

 Console (bool _clearOnInit=false, bool _fillScreen=false)
 The default constructor.
 Console (FILE *_outputBuffer, FILE *_inputBuffer)
 The alternate constructor.
 ~Console ()
 The destructor.
void SetColour ()
 Sets the console output colour to the default.
void SetColour (int _flags)
 Sets the console output colour.
void SetTitle (const char *_title)
 Sets the title of the terminal window.
void SetTitle (std::string &_title)
 Sets the title of the terminal window.
void Clear ()
 Clears the console.
void MoveUp (int _lines)
 Move the cursor up a given number of lines.
void Flush ()
 Flushes the input and output buffers.

Private Member Functions

bool EndOfFile ()
 Determines whether the end of the file has been reached.
int Forward (cc_int64_t _position)
 Moves forward to a location in the buffer.
int Seek (cc_int64_t _position)
 Seeks to a location in the buffer.
cc_int64_t Length ()
 Determines the length of the file buffer.
int Read (char *_buffer, size_t _bufferLength, size_t _bufferIndex, size_t _count)
 Reads a block of data from the file buffer.


Detailed Description

The core console input/output class.

Member Enumeration Documentation

Flags used for describing console colour output.

Enumerator:
FG_GREEN  < Blue Foreground
FG_RED  < Green Foreground
FG_INTENSITY  < Red Foreground
BG_BLUE  < Foreground intensity (makes the foreground colour a shade brighter)
BG_GREEN  < Blue Background
BG_RED  < Green Background
BG_INTENSITY  < Red Background


Constructor & Destructor Documentation

Console ( bool  _clearOnInit = false,
bool  _fillScreen = false 
)

The default constructor.

Allocates a new console for stdout and stderr output.

Parameters:
_clearOnInit If true, clears the output console if supported.
_fillScreen This moves the console window to the extreme left and switches to the maximum possible window height.

Console ( FILE *  _outputBuffer,
FILE *  _inputBuffer 
)

The alternate constructor.

Does not allocate a new console, and instead uses the specified FILE* parameters for input/output.

Parameters:
_outputBuffer The buffer for Console output.
_inputBuffer The buffer for Console input.
See also:
Console()


Member Function Documentation

void Clear (  ) 

Clears the console.

Clears the console output (similar to commands 'cls' on Windows and 'clear' on Linux).

bool EndOfFile (  )  [private, virtual]

Determines whether the end of the file has been reached.

Returns:
Boolean indicating whether the end of the file has been reached.

Reimplemented from CoreIOReader.

int Forward ( cc_int64_t  _position  )  [private, virtual]

Moves forward to a location in the buffer.

Parameters:
_position Position to seek to, relative to the current position in the buffer.
Returns:
An integer indicating the result of the operation. 0 indicates success. Any non-zero number indicates failure.

Reimplemented from CoreIOReader.

cc_int64_t Length (  )  [private, virtual]

Determines the length of the file buffer.

Returns:
Indicates the length of the buffer in bytes.

Reimplemented from CoreIOReader.

void MoveUp ( int  _lines  ) 

Move the cursor up a given number of lines.

Permits you to overwrite previous lines. Good for a status display.

Parameters:
_lines Number of lines to move the cursor

int Read ( char *  _buffer,
size_t  _bufferLength,
size_t  _bufferIndex,
size_t  _count 
) [private, virtual]

Reads a block of data from the file buffer.

Parameters:
_buffer The output buffer to read to.
_bufferLength The size of _buffer (in bytes).
_bufferIndex The position in _buffer to begin writing.
_count The number of bytes to read.
Returns:
The actual number of bytes read.

Reimplemented from CoreIOReader.

int Seek ( cc_int64_t  _position  )  [private, virtual]

Seeks to a location in the buffer.

Parameters:
_position Position to seek to, relative to the first byte of the buffer.
Returns:
An integer indicating the result of the operation. 0 indicates success. Any non-zero number indicates failure.

Reimplemented from CoreIOReader.

void SetColour ( int  _flags  ) 

Sets the console output colour.

Sets the console output colour using the flags specified in _flags.

Parameters:
_flags A bitmask created by OR-ing Console::ColourTypes flags.

void SetTitle ( std::string &  _title  ) 

Sets the title of the terminal window.

Sets the console window title using the value in the _title parameter.

Parameters:
_title The title requested for the console window.

void SetTitle ( const char *  _title  ) 

Sets the title of the terminal window.

Sets the console window title using the value in the _title parameter.

Parameters:
_title The title requested for the console window.


Generated on Sun Feb 8 11:10:00 2009 for CrissCross by  doxygen 1.5.8