diff options
author | Tom Tromey <tom@tromey.com> | 2022-04-05 07:44:59 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-04-05 14:46:14 -0600 |
commit | c269d90a4905f313c538ed1caf182b8d48ff1f30 (patch) | |
tree | 54dd3c55151325710c29f0be05d74611caf22ca3 /gdb/pager.h | |
parent | 4815d6125ec580cc02a1094d61b8c9d1cc83c0a1 (diff) | |
download | gdb-c269d90a4905f313c538ed1caf182b8d48ff1f30.zip gdb-c269d90a4905f313c538ed1caf182b8d48ff1f30.tar.gz gdb-c269d90a4905f313c538ed1caf182b8d48ff1f30.tar.bz2 |
Introduce wrapped_file
Simon pointed out that timestamped_file probably needed to implement a
few more methods. This patch introduces a new file-wrapping file that
forwards most of its calls, making it simpler to implement new such
files. It also converts timestamped_file and pager_file to use it.
Regression tested on x86-64 Fedora 34.
Diffstat (limited to 'gdb/pager.h')
-rw-r--r-- | gdb/pager.h | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/gdb/pager.h b/gdb/pager.h index 0151a28..d2a3a2b 100644 --- a/gdb/pager.h +++ b/gdb/pager.h @@ -23,16 +23,21 @@ /* A ui_file that implements output paging and unfiltered output. */ -class pager_file : public ui_file +class pager_file : public wrapped_file { public: /* Create a new pager_file. The new object takes ownership of STREAM. */ explicit pager_file (ui_file *stream) - : m_stream (stream) + : wrapped_file (stream) { } + ~pager_file () + { + delete m_stream; + } + DISABLE_COPY_AND_ASSIGN (pager_file); void write (const char *buf, long length_buf) override; @@ -44,31 +49,11 @@ public: m_stream->write_async_safe (buf, length_buf); } - bool term_out () override - { - return m_stream->term_out (); - } - - bool isatty () override - { - return m_stream->isatty (); - } - - bool can_emit_style_escape () override - { - return m_stream->can_emit_style_escape (); - } - void emit_style_escape (const ui_file_style &style) override; void reset_style () override; void flush () override; - int fd () const override - { - return m_stream->fd (); - } - void wrap_here (int indent) override; void puts_unfiltered (const char *str) override @@ -98,9 +83,6 @@ private: /* The style applied at the time that wrap_here was called. */ ui_file_style m_wrap_style; - /* The unfiltered output stream. */ - ui_file_up m_stream; - /* This is temporarily set when paging. This will cause some methods to change their behavior to ignore the wrap buffer. */ bool m_paging = false; |