#include <winstl/system/console_colour_scope.hpp>
This class provides scoping of the colour (and intensity) of the console via the API functions GetConsoleScreenBufferInfo()
and SetConsoleTextAttribute()
.
Public Types | |
typedef console_colour_scope | class_type |
This type. | |
Public Member Functions | |
console_colour_scope (HANDLE hBuffer, WORD textAttributes) | |
Sets the console text attribute(s), remembering the current state so it can be reset in the destructor. | |
~console_colour_scope () throw () | |
Resets the console text attribute(s) to the original form. |
typedef console_colour_scope class_type |
This type.
console_colour_scope | ( | HANDLE | hBuffer, | |
WORD | textAttributes | |||
) | [inline, explicit] |
Sets the console text attribute(s), remembering the current state so it can be reset in the destructor.
The constructor applies the given text attributes to the given console screen buffer, after first recording the current state so that they can be reset when the instance is destroyed.
winstl::windows_exception | If exception handling is enabled, an instance of windows_exception will be thrown if the console text attributes cannot be elicited or changed. If exception handling is not enabled, the console attributes are left as they are, and the destructor makes no attempt at modification. |
hBuffer | Handle the console screen buffer. | |
textAttributes | The text attributes to be applied to the console |
~console_colour_scope | ( | ) | throw () [inline] |
Resets the console text attribute(s) to the original form.