More updated translations
[binutils-gdb.git] / gdb / cli-out.h
blobbdbf99097adc9811179b8c212471d2c79bcfd28b
1 /* Output generating routines for GDB CLI.
2 Copyright (C) 1999-2024 Free Software Foundation, Inc.
3 Contributed by Cygnus Solutions.
5 This file is part of GDB.
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
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #ifndef GDB_CLI_OUT_H
21 #define GDB_CLI_OUT_H
23 #include "ui-out.h"
24 #include <chrono>
25 #include <vector>
27 class cli_ui_out : public ui_out
29 public:
31 explicit cli_ui_out (ui_file *stream, ui_out_flags flags = ui_source_list);
32 virtual ~cli_ui_out ();
34 ui_file *set_stream (ui_file *stream);
36 bool can_emit_style_escape () const override;
38 ui_file *current_stream () const override
39 { return m_streams.back (); }
41 protected:
43 virtual void do_table_begin (int nbrofcols, int nr_rows,
44 const char *tblid) override;
45 virtual void do_table_body () override;
46 virtual void do_table_end () override;
47 virtual void do_table_header (int width, ui_align align,
48 const std::string &col_name,
49 const std::string &col_hdr) override;
50 /* Note: level 0 is the top-level so LEVEL is always greater than
51 zero. */
52 virtual void do_begin (ui_out_type type, const char *id) override;
53 virtual void do_end (ui_out_type type) override;
54 virtual void do_field_signed (int fldno, int width, ui_align align,
55 const char *fldname, LONGEST value,
56 const ui_file_style &style) override;
57 virtual void do_field_unsigned (int fldno, int width, ui_align align,
58 const char *fldname, ULONGEST value)
59 override;
60 virtual void do_field_skip (int fldno, int width, ui_align align,
61 const char *fldname) override;
62 virtual void do_field_string (int fldno, int width, ui_align align,
63 const char *fldname,
64 const char *string,
65 const ui_file_style &style) override;
66 virtual void do_field_fmt (int fldno, int width, ui_align align,
67 const char *fldname, const ui_file_style &style,
68 const char *format, va_list args)
69 override ATTRIBUTE_PRINTF (7, 0);
70 virtual void do_spaces (int numspaces) override;
71 virtual void do_text (const char *string) override;
72 virtual void do_message (const ui_file_style &style,
73 const char *format, va_list args) override
74 ATTRIBUTE_PRINTF (3,0);
75 virtual void do_wrap_hint (int indent) override;
76 virtual void do_flush () override;
77 virtual void do_redirect (struct ui_file *outstream) override;
79 virtual void do_progress_start () override;
80 virtual void do_progress_notify (const std::string &, const char *,
81 double, double) override;
82 virtual void do_progress_end () override;
84 bool suppress_output ()
85 { return m_suppress_output; }
87 private:
89 void field_separator ();
91 std::vector<ui_file *> m_streams;
92 bool m_suppress_output;
94 /* The state of a recent progress update. */
95 struct cli_progress_info
97 /* Position of the progress indicator. */
98 int pos;
99 /* The current state. */
100 progress_update::state state;
101 /* Progress indicator's time of last update. */
102 std::chrono::steady_clock::time_point last_update;
104 cli_progress_info ()
105 : pos (0), state (progress_update::START)
109 /* Stack of progress info. */
110 std::vector<cli_progress_info> m_progress_info;
111 void clear_progress_notify ();
114 extern void cli_display_match_list (char **matches, int len, int max);
116 #endif /* GDB_CLI_OUT_H */