diff options
Diffstat (limited to 'include/lldb/Host/File.h')
-rw-r--r-- | include/lldb/Host/File.h | 56 |
1 files changed, 51 insertions, 5 deletions
diff --git a/include/lldb/Host/File.h b/include/lldb/Host/File.h index 607efa029c09..814d96059f37 100644 --- a/include/lldb/Host/File.h +++ b/include/lldb/Host/File.h @@ -51,7 +51,10 @@ public: m_descriptor (kInvalidDescriptor), m_stream (kInvalidStream), m_options (0), - m_owned (false) + m_own_stream (false), + m_own_descriptor (false), + m_is_interactive (eLazyBoolCalculate), + m_is_real_terminal (eLazyBoolCalculate) { } @@ -59,7 +62,10 @@ public: m_descriptor (kInvalidDescriptor), m_stream (fh), m_options (0), - m_owned (transfer_ownership) + m_own_stream (transfer_ownership), + m_own_descriptor (false), + m_is_interactive (eLazyBoolCalculate), + m_is_real_terminal (eLazyBoolCalculate) { } @@ -111,13 +117,15 @@ public: uint32_t options, uint32_t permissions = lldb::eFilePermissionsFileDefault); - File (int fd, bool tranfer_ownership) : + File (int fd, bool transfer_ownership) : m_descriptor (fd), m_stream (kInvalidStream), m_options (0), - m_owned (tranfer_ownership) + m_own_stream (false), + m_own_descriptor (transfer_ownership) { } + //------------------------------------------------------------------ /// Destructor. /// @@ -458,6 +466,32 @@ public: static uint32_t GetPermissions (const char *path, Error &error); + + //------------------------------------------------------------------ + /// Return true if this file is interactive. + /// + /// @return + /// True if this file is a terminal (tty or pty), false + /// otherwise. + //------------------------------------------------------------------ + bool + GetIsInteractive (); + + //------------------------------------------------------------------ + /// Return true if this file from a real terminal. + /// + /// Just knowing a file is a interactive isn't enough, we also need + /// to know if the terminal has a width and height so we can do + /// cursor movement and other terminal maninpulations by sending + /// escape sequences. + /// + /// @return + /// True if this file is a terminal (tty, not a pty) that has + /// a non-zero width and height, false otherwise. + //------------------------------------------------------------------ + bool + GetIsRealTerminal (); + //------------------------------------------------------------------ /// Output printf formatted output to the stream. /// @@ -476,6 +510,12 @@ public: size_t PrintfVarArg(const char *format, va_list args); + + void + SetOptions (uint32_t options) + { + m_options = options; + } protected: @@ -491,13 +531,19 @@ protected: return m_stream != kInvalidStream; } + void + CalculateInteractiveAndTerminal (); + //------------------------------------------------------------------ // Member variables //------------------------------------------------------------------ int m_descriptor; FILE *m_stream; uint32_t m_options; - bool m_owned; + bool m_own_stream; + bool m_own_descriptor; + LazyBool m_is_interactive; + LazyBool m_is_real_terminal; }; } // namespace lldb_private |