Ookii.CommandLine for C++
2.0.0
|
Handles the lifetime of virtual terminal support. More...
#include <ookii/vt_helper.h>
Public Member Functions | |
virtual_terminal_support ()=default | |
Initializes a new instance of the virtual_terminal_support class. More... | |
virtual_terminal_support (const virtual_terminal_support &)=delete | |
virtual_terminal_support (virtual_terminal_support &&)=default | |
Move constructor for virtual_terminal_support. | |
bool | is_supported () const noexcept |
Gets a value that indicates whether the stream supports virtual terminal sequences. | |
operator bool () const noexcept | |
Gets a value that indicates whether the stream supports virtual terminal sequences. | |
virtual_terminal_support & | operator= (const virtual_terminal_support &)=delete |
virtual_terminal_support & | operator= (virtual_terminal_support &&)=default |
Move assignment operator for virtual_terminal_support. | |
void | reset () noexcept |
Restores the console mode to its previous value, if it had been changed. More... | |
Static Public Member Functions | |
static virtual_terminal_support | enable (standard_stream stream) |
Enables virtual terminal sequences for the console attached to the specified stream. More... | |
static virtual_terminal_support | enable_color (standard_stream stream) |
Enables color support using virtual terminal sequences for the console attached to the specified stream. More... | |
Handles the lifetime of virtual terminal support.
On Windows, this restores the terminal mode to its previous value when destructed. On other platforms, this does nothing.
To create an instance of this class, you should use the enable_virtual_terminal_sequences() or enable_color() function.
|
default |
Initializes a new instance of the virtual_terminal_support class.
An instance created this way will indicate virtual terminal sequences are not supported and will not do anything when destructed.
|
inlinestatic |
Enables virtual terminal sequences for the console attached to the specified stream.
Virtual terminal sequences are supported if the specified stream is a terminal according to isatty()
, and the TERM environment variable is not set to "dumb". On Windows, enabling VT support has to succeed. On non-Windows platforms, VT support is assumed if the TERM environment variable is defined.
stream | The standard_stream to enable VT sequences for. |
|
inlinestatic |
Enables color support using virtual terminal sequences for the console attached to the specified stream.
If an environment variable named "NO_COLOR" exists, this function will not enable VT sequences. Otherwise, this function calls the enable_virtual_terminal_sequences() function and returns its result.
stream | The standard_stream to enable VT sequences for. |
|
inlinenoexcept |
Restores the console mode to its previous value, if it had been changed.
On non-Windows platforms, this does nothing.