]>
Commit | Line | Data |
---|---|---|
8b93c638 | 1 | /* Output generating routines for GDB CLI. |
213516ef | 2 | Copyright (C) 1999-2023 Free Software Foundation, Inc. |
8b93c638 JM |
3 | Contributed by Cygnus Solutions. |
4 | ||
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 9 | the Free Software Foundation; either version 3 of the License, or |
8b93c638 JM |
10 | (at your option) any later version. |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
a9762ec7 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
8b93c638 JM |
19 | |
20 | #ifndef CLI_OUT_H | |
21 | #define CLI_OUT_H | |
22 | ||
d55e5aa6 | 23 | #include "ui-out.h" |
27859c6b | 24 | #include <chrono> |
4de283e4 | 25 | #include <vector> |
d55e5aa6 | 26 | |
112e8700 SM |
27 | class cli_ui_out : public ui_out |
28 | { | |
29 | public: | |
0a8fce9a | 30 | |
66fd2c67 | 31 | explicit cli_ui_out (ui_file *stream, ui_out_flags flags = ui_source_list); |
112e8700 | 32 | virtual ~cli_ui_out (); |
0a8fce9a | 33 | |
112e8700 | 34 | ui_file *set_stream (ui_file *stream); |
0a8fce9a | 35 | |
046bebe1 TT |
36 | bool can_emit_style_escape () const override; |
37 | ||
112e8700 | 38 | protected: |
da3331ec | 39 | |
112e8700 | 40 | virtual void do_table_begin (int nbrofcols, int nr_rows, |
e427af18 | 41 | const char *tblid) override; |
112e8700 SM |
42 | virtual void do_table_body () override; |
43 | virtual void do_table_end () override; | |
44 | virtual void do_table_header (int width, ui_align align, | |
e427af18 TT |
45 | const std::string &col_name, |
46 | const std::string &col_hdr) override; | |
112e8700 SM |
47 | /* Note: level 0 is the top-level so LEVEL is always greater than |
48 | zero. */ | |
49 | virtual void do_begin (ui_out_type type, const char *id) override; | |
50 | virtual void do_end (ui_out_type type) override; | |
381befee TT |
51 | virtual void do_field_signed (int fldno, int width, ui_align align, |
52 | const char *fldname, LONGEST value) override; | |
1f77b012 TT |
53 | virtual void do_field_unsigned (int fldno, int width, ui_align align, |
54 | const char *fldname, ULONGEST value) | |
55 | override; | |
112e8700 | 56 | virtual void do_field_skip (int fldno, int width, ui_align align, |
e427af18 | 57 | const char *fldname) override; |
112e8700 | 58 | virtual void do_field_string (int fldno, int width, ui_align align, |
e427af18 | 59 | const char *fldname, |
cbe56571 | 60 | const char *string, |
e43b10e1 | 61 | const ui_file_style &style) override; |
112e8700 | 62 | virtual void do_field_fmt (int fldno, int width, ui_align align, |
7f6aba03 TT |
63 | const char *fldname, const ui_file_style &style, |
64 | const char *format, va_list args) | |
65 | override ATTRIBUTE_PRINTF (7, 0); | |
112e8700 SM |
66 | virtual void do_spaces (int numspaces) override; |
67 | virtual void do_text (const char *string) override; | |
2a3c1174 PA |
68 | virtual void do_message (const ui_file_style &style, |
69 | const char *format, va_list args) override | |
70 | ATTRIBUTE_PRINTF (3,0); | |
6c92c339 | 71 | virtual void do_wrap_hint (int indent) override; |
112e8700 | 72 | virtual void do_flush () override; |
7becfd03 | 73 | virtual void do_redirect (struct ui_file *outstream) override; |
8b93c638 | 74 | |
27859c6b AM |
75 | virtual void do_progress_start () override; |
76 | virtual void do_progress_notify (const std::string &, const char *, | |
77 | double, double) override; | |
2f228731 TT |
78 | virtual void do_progress_end () override; |
79 | ||
112e8700 SM |
80 | bool suppress_output () |
81 | { return m_suppress_output; } | |
0a8fce9a | 82 | |
112e8700 SM |
83 | private: |
84 | ||
85 | void field_separator (); | |
112e8700 SM |
86 | |
87 | std::vector<ui_file *> m_streams; | |
88 | bool m_suppress_output; | |
2f228731 | 89 | |
27859c6b | 90 | /* The state of a recent progress update. */ |
2f228731 TT |
91 | struct cli_progress_info |
92 | { | |
27859c6b AM |
93 | /* Position of the progress indicator. */ |
94 | int pos; | |
2f228731 | 95 | /* The current state. */ |
27859c6b AM |
96 | progress_update::state state; |
97 | /* Progress indicator's time of last update. */ | |
98 | std::chrono::steady_clock::time_point last_update; | |
99 | ||
100 | cli_progress_info () | |
101 | : pos (0), state (progress_update::START) | |
102 | {} | |
2f228731 TT |
103 | }; |
104 | ||
27859c6b AM |
105 | /* Stack of progress info. */ |
106 | std::vector<cli_progress_info> m_progress_info; | |
107 | void clear_current_line (); | |
112e8700 SM |
108 | }; |
109 | ||
82083d6d DE |
110 | extern void cli_display_match_list (char **matches, int len, int max); |
111 | ||
8b93c638 | 112 | #endif |