LLDB mainline
lldb_private::Terminal Class Reference

#include <Terminal.h>

Classes

struct  Data

Public Types

enum class  Parity {
  No , Even , Odd , Space ,
  Mark
}
enum class  ParityCheck { No , ReplaceWithNUL , Ignore , Mark }

Public Member Functions

 Terminal (int fd=-1)
 ~Terminal ()=default
bool IsATerminal () const
int GetFileDescriptor () const
void SetFileDescriptor (int fd)
bool FileDescriptorIsValid () const
void Clear ()
llvm::Error SetEcho (bool enabled)
llvm::Error SetCanonical (bool enabled)
llvm::Error SetRaw ()
llvm::Error SetBaudRate (unsigned int baud_rate)
llvm::Error SetStopBits (unsigned int stop_bits)
llvm::Error SetParity (Parity parity)
llvm::Error SetParityCheck (ParityCheck parity_check)
llvm::Error SetHardwareFlowControl (bool enabled)

Static Public Member Functions

static bool SupportsUnicode ()
 Returns whether or not the current terminal supports Unicode rendering.

Protected Member Functions

llvm::Expected< DataGetData ()
llvm::Error SetData (const Data &data)

Protected Attributes

int m_fd

Friends

class TerminalState

Detailed Description

Definition at line 19 of file Terminal.h.

Member Enumeration Documentation

◆ Parity

enum class lldb_private::Terminal::Parity
strong
Enumerator
No 
Even 
Odd 
Space 
Mark 

Definition at line 21 of file Terminal.h.

◆ ParityCheck

Enumerator
No 
ReplaceWithNUL 
Ignore 
Mark 

Definition at line 29 of file Terminal.h.

Constructor & Destructor Documentation

◆ Terminal()

lldb_private::Terminal::Terminal ( int fd = -1)
inline

Definition at line 41 of file Terminal.h.

References m_fd.

◆ ~Terminal()

lldb_private::Terminal::~Terminal ( )
default

Member Function Documentation

◆ Clear()

void lldb_private::Terminal::Clear ( )
inline

Definition at line 53 of file Terminal.h.

References m_fd.

◆ FileDescriptorIsValid()

bool lldb_private::Terminal::FileDescriptorIsValid ( ) const
inline

Definition at line 51 of file Terminal.h.

References m_fd.

Referenced by GetData(), and SetData().

◆ GetData()

llvm::Expected< Terminal::Data > Terminal::GetData ( )
protected

◆ GetFileDescriptor()

int lldb_private::Terminal::GetFileDescriptor ( ) const
inline

Definition at line 47 of file Terminal.h.

References m_fd.

◆ IsATerminal()

bool Terminal::IsATerminal ( ) const

Definition at line 31 of file Terminal.cpp.

References m_fd.

Referenced by GetData(), and SetData().

◆ SetBaudRate()

llvm::Error Terminal::SetBaudRate ( unsigned int baud_rate)

Definition at line 273 of file Terminal.cpp.

References GetData(), SetData(), and termiosMissingError().

Referenced by lldb_private::SerialPort::Create().

◆ SetCanonical()

llvm::Error Terminal::SetCanonical ( bool enabled)

Definition at line 92 of file Terminal.cpp.

References GetData(), SetData(), and termiosMissingError().

Referenced by IOHandlerProcessSTDIO::Run().

◆ SetData()

llvm::Error Terminal::SetData ( const Data & data)
protected

◆ SetEcho()

llvm::Error Terminal::SetEcho ( bool enabled)

Definition at line 76 of file Terminal.cpp.

References GetData(), SetData(), and termiosMissingError().

Referenced by IOHandlerProcessSTDIO::Run().

◆ SetFileDescriptor()

void lldb_private::Terminal::SetFileDescriptor ( int fd)
inline

Definition at line 49 of file Terminal.h.

References m_fd.

◆ SetHardwareFlowControl()

llvm::Error Terminal::SetHardwareFlowControl ( bool enabled)

Definition at line 379 of file Terminal.cpp.

References GetData(), SetData(), and termiosMissingError().

◆ SetParity()

llvm::Error Terminal::SetParity ( Terminal::Parity parity)

Definition at line 324 of file Terminal.cpp.

References GetData(), Mark, No, Odd, SetData(), Space, and termiosMissingError().

Referenced by lldb_private::SerialPort::Create().

◆ SetParityCheck()

llvm::Error Terminal::SetParityCheck ( Terminal::ParityCheck parity_check)

Definition at line 357 of file Terminal.cpp.

References GetData(), Ignore, Mark, No, SetData(), and termiosMissingError().

Referenced by lldb_private::SerialPort::Create().

◆ SetRaw()

llvm::Error Terminal::SetRaw ( )

Definition at line 108 of file Terminal.cpp.

References GetData(), SetData(), and termiosMissingError().

Referenced by lldb_private::SerialPort::Create().

◆ SetStopBits()

llvm::Error Terminal::SetStopBits ( unsigned int stop_bits)

Definition at line 299 of file Terminal.cpp.

References GetData(), SetData(), and termiosMissingError().

Referenced by lldb_private::SerialPort::Create().

◆ SupportsUnicode()

bool Terminal::SupportsUnicode ( )
static

Returns whether or not the current terminal supports Unicode rendering.

The value is cached after the first computation.

On POSIX systems, we check if the LANG environment variable contains the substring "UTF-8", case insensitive.

On Windows, we always return true since we use the WriteConsoleW API internally. Note that the default Windows codepage (437) does not support all Unicode characters. This function does not check the codepage.

Definition at line 403 of file Terminal.cpp.

Referenced by lldb_private::RenderDiagnosticDetails().

◆ TerminalState

friend class TerminalState
friend

Definition at line 91 of file Terminal.h.

References TerminalState.

Referenced by TerminalState.

Member Data Documentation

◆ m_fd

int lldb_private::Terminal::m_fd
protected

The documentation for this class was generated from the following files: