|
LLDB mainline
|
A RAII-friendly terminal state saving/restoring class. More...
#include "lldb/Host/Terminal.h"
Public Member Functions | |
| TerminalState (Terminal term=-1, bool save_process_group=false) | |
| Construct a new instance and optionally save terminal state. | |
| ~TerminalState () | |
| Destroy the instance, restoring terminal state if saved. | |
| bool | Save (Terminal term, bool save_process_group) |
| Save the TTY state for fd. | |
| bool | Restore () const |
| Restore the TTY state to the cached state. | |
| bool | IsValid () const |
| Test for valid cached TTY state information. | |
| void | Clear () |
Protected Member Functions | |
| bool | TFlagsIsValid () const |
| Test if tflags is valid. | |
| bool | TTYStateIsValid () const |
| Test if ttystate is valid. | |
| bool | ProcessGroupIsValid () const |
| Test if the process group information is valid. | |
Protected Attributes | |
| Terminal | m_tty |
| A terminal. | |
| int | m_tflags = -1 |
| Cached tflags information. | |
| std::unique_ptr< Terminal::Data > | m_data |
| Platform-specific implementation. | |
| lldb::pid_t | m_process_group = -1 |
| Cached process group information. | |
A RAII-friendly terminal state saving/restoring class.
This class can be used to remember the terminal state for a file descriptor and later restore that state as it originally was.
Definition at line 87 of file Terminal.h.
Construct a new instance and optionally save terminal state.
| [in] | term | The Terminal instance holding the file descriptor to save the state of. If the instance is not associated with a fd, no state will be saved. |
| [in] | save_process_group | If true, save the process group settings, else do not save the process group settings for a TTY. |
Definition at line 403 of file Terminal.cpp.
| TerminalState::~TerminalState | ( | ) |
Destroy the instance, restoring terminal state if saved.
If restoring state is undesirable, the instance needs to be reset before destruction.
Definition at line 408 of file Terminal.cpp.
References Restore().
| void TerminalState::Clear | ( | ) |
Definition at line 410 of file Terminal.cpp.
References m_data, m_process_group, m_tflags, and m_tty.
Referenced by Save().
| bool TerminalState::IsValid | ( | ) | const |
Test for valid cached TTY state information.
Definition at line 463 of file Terminal.cpp.
References m_tty, ProcessGroupIsValid(), TFlagsIsValid(), and TTYStateIsValid().
|
protected |
Test if the process group information is valid.
Definition at line 472 of file Terminal.cpp.
References m_process_group.
| bool TerminalState::Restore | ( | ) | const |
Restore the TTY state to the cached state.
Restore the state of the TTY using the cached values from a previous call to TerminalState::Save(int,bool).
Definition at line 436 of file Terminal.cpp.
References IsValid(), m_data, m_process_group, m_tflags, m_tty, ProcessGroupIsValid(), TFlagsIsValid(), and TTYStateIsValid().
Referenced by ~TerminalState().
Save the TTY state for fd.
Save the current state of the TTY for the file descriptor "fd" and if "save_process_group" is true, attempt to save the process group info for the TTY.
| [in] | term | The Terminal instance holding fd to save. |
| [in] | save_process_group | If true, save the process group settings, else do not save the process group settings for a TTY. |
Definition at line 417 of file Terminal.cpp.
References Clear(), IsValid(), m_data, m_process_group, m_tflags, and m_tty.
Referenced by TerminalState().
|
protected |
Test if tflags is valid.
Definition at line 468 of file Terminal.cpp.
References m_tflags.
|
protected |
Test if ttystate is valid.
Definition at line 470 of file Terminal.cpp.
References m_data.
|
protected |
Platform-specific implementation.
Definition at line 168 of file Terminal.h.
Referenced by Clear(), Restore(), Save(), and TTYStateIsValid().
|
protected |
Cached process group information.
Definition at line 169 of file Terminal.h.
Referenced by Clear(), ProcessGroupIsValid(), Restore(), and Save().
|
protected |
Cached tflags information.
Definition at line 167 of file Terminal.h.
Referenced by Clear(), Restore(), Save(), and TFlagsIsValid().
|
protected |
A terminal.
Definition at line 166 of file Terminal.h.
Referenced by Clear(), IsValid(), Restore(), Save(), and TerminalState().