GDB (xrefs)
Loading...
Searching...
No Matches
gdb
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
26
class
pager_file
:
public
wrapped_file
27
{
28
public
:
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
36
~pager_file
()
37
{
38
delete
m_stream
;
39
}
40
41
DISABLE_COPY_AND_ASSIGN
(
pager_file
);
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
{
61
flush_wrap_buffer
();
62
m_stream
->
puts_unfiltered
(str);
63
}
64
65
private
:
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. */
77
int
m_wrap_indent
= 0;
78
79
/* Column number on the screen where wrap_buffer begins, or 0 if
80
wrapping is not in effect. */
81
int
m_wrap_column
= 0;
82
83
/* The style applied at the time that wrap_here was called. */
84
ui_file_style
m_wrap_style
;
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
Definition
pager.h:27
pager_file::pager_file
pager_file(ui_file *stream)
Definition
pager.h:31
pager_file::m_wrap_style
ui_file_style m_wrap_style
Definition
pager.h:84
pager_file::emit_style_escape
void emit_style_escape(const ui_file_style &style) override
Definition
utils.c:1359
pager_file::m_wrap_buffer
std::string m_wrap_buffer
Definition
pager.h:74
pager_file::m_wrap_indent
int m_wrap_indent
Definition
pager.h:77
pager_file::puts
void puts(const char *str) override
Definition
utils.c:1598
pager_file::prompt_for_continue
void prompt_for_continue()
Definition
utils.c:1389
pager_file::flush
void flush() override
Definition
utils.c:1489
pager_file::wrap_here
void wrap_here(int indent) override
Definition
utils.c:1514
pager_file::m_wrap_column
int m_wrap_column
Definition
pager.h:81
pager_file::puts_unfiltered
void puts_unfiltered(const char *str) override
Definition
pager.h:59
pager_file::reset_style
void reset_style() override
Definition
utils.c:1374
pager_file::m_paging
bool m_paging
Definition
pager.h:88
pager_file::DISABLE_COPY_AND_ASSIGN
DISABLE_COPY_AND_ASSIGN(pager_file)
pager_file::flush_wrap_buffer
void flush_wrap_buffer()
Definition
utils.c:1479
pager_file::~pager_file
~pager_file()
Definition
pager.h:36
pager_file::write
void write(const char *buf, long length_buf) override
Definition
utils.c:1765
pager_file::write_async_safe
void write_async_safe(const char *buf, long length_buf) override
Definition
pager.h:47
ui_file
Definition
ui-file.h:28
ui_file::write_async_safe
virtual void write_async_safe(const char *buf, long length_buf)
Definition
ui-file.h:71
ui_file::puts_unfiltered
virtual void puts_unfiltered(const char *str)
Definition
ui-file.h:132
wrapped_file
Definition
ui-file.h:401
wrapped_file::m_stream
ui_file * m_stream
Definition
ui-file.h:446
ui_file_style
Definition
ui-style.h:24
ui-file.h
Generated by
1.10.0