GDB (xrefs)
Loading...
Searching...
No Matches
pager.h
Go to the documentation of this file.
1/* Output pager for gdb
2 Copyright (C) 2021-2023 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19#ifndef GDB_PAGER_H
20#define GDB_PAGER_H
21
22#include "ui-file.h"
23
24/* A ui_file that implements output paging and unfiltered output. */
25
27{
28public:
29 /* Create a new pager_file. The new object takes ownership of
30 STREAM. */
31 explicit pager_file (ui_file *stream)
32 : wrapped_file (stream)
33 {
34 }
35
37 {
38 delete m_stream;
39 }
40
42
43 void write (const char *buf, long length_buf) override;
44
45 void puts (const char *str) override;
46
47 void write_async_safe (const char *buf, long length_buf) override
48 {
49 m_stream->write_async_safe (buf, length_buf);
50 }
51
52 void emit_style_escape (const ui_file_style &style) override;
53 void reset_style () override;
54
55 void flush () override;
56
57 void wrap_here (int indent) override;
58
59 void puts_unfiltered (const char *str) override
60 {
63 }
64
65private:
66
67 void prompt_for_continue ();
68
69 /* Flush the wrap buffer to STREAM, if necessary. */
70 void flush_wrap_buffer ();
71
72 /* Contains characters which are waiting to be output (they have
73 already been counted in chars_printed). */
74 std::string m_wrap_buffer;
75
76 /* Amount to indent by if the wrap occurs. */
78
79 /* Column number on the screen where wrap_buffer begins, or 0 if
80 wrapping is not in effect. */
82
83 /* The style applied at the time that wrap_here was called. */
85
86 /* This is temporarily set when paging. This will cause some
87 methods to change their behavior to ignore the wrap buffer. */
88 bool m_paging = false;
89};
90
91#endif /* GDB_PAGER_H */
pager_file(ui_file *stream)
Definition pager.h:31
ui_file_style m_wrap_style
Definition pager.h:84
void emit_style_escape(const ui_file_style &style) override
Definition utils.c:1359
std::string m_wrap_buffer
Definition pager.h:74
int m_wrap_indent
Definition pager.h:77
void puts(const char *str) override
Definition utils.c:1598
void prompt_for_continue()
Definition utils.c:1389
void flush() override
Definition utils.c:1489
void wrap_here(int indent) override
Definition utils.c:1514
int m_wrap_column
Definition pager.h:81
void puts_unfiltered(const char *str) override
Definition pager.h:59
void reset_style() override
Definition utils.c:1374
bool m_paging
Definition pager.h:88
DISABLE_COPY_AND_ASSIGN(pager_file)
void flush_wrap_buffer()
Definition utils.c:1479
~pager_file()
Definition pager.h:36
void write(const char *buf, long length_buf) override
Definition utils.c:1765
void write_async_safe(const char *buf, long length_buf) override
Definition pager.h:47
virtual void write_async_safe(const char *buf, long length_buf)
Definition ui-file.h:71
virtual void puts_unfiltered(const char *str)
Definition ui-file.h:132
ui_file * m_stream
Definition ui-file.h:446