]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/mi/mi-out.h
Use field_string in more places
[thirdparty/binutils-gdb.git] / gdb / mi / mi-out.h
CommitLineData
fb40c209 1/* MI Command Set - MI output generating routines for GDB.
42a4f53d 2 Copyright (C) 2000-2019 Free Software Foundation, Inc.
ab91fdd5 3 Contributed by Cygnus Solutions (a Red Hat company).
fb40c209
AC
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
fb40c209
AC
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/>. */
fb40c209 19
1a5c2598
TT
20#ifndef MI_MI_OUT_H
21#define MI_MI_OUT_H
fb40c209 22
112e8700
SM
23#include <vector>
24
fb40c209
AC
25struct ui_out;
26struct ui_file;
fb40c209 27
fb40c209 28
112e8700
SM
29class mi_ui_out : public ui_out
30{
31public:
32
d7e74731 33 explicit mi_ui_out (int mi_version);
112e8700
SM
34 virtual ~mi_ui_out ();
35
36 /* MI-specific */
37 void rewind ();
38 void put (struct ui_file *stream);
39
40 /* Return the version number of the current MI. */
41 int version ();
42
43protected:
44
45 virtual void do_table_begin (int nbrofcols, int nr_rows, const char *tblid)
46 override;
47 virtual void do_table_body () override;
48 virtual void do_table_header (int width, ui_align align,
49 const std::string &col_name,
50 const std::string &col_hdr) override;
51 virtual void do_table_end () override;
52
53 virtual void do_begin (ui_out_type type, const char *id) override;
54 virtual void do_end (ui_out_type type) override;
55 virtual void do_field_int (int fldno, int width, ui_align align,
56 const char *fldname, int value) override;
57 virtual void do_field_skip (int fldno, int width, ui_align align,
58 const char *fldname) override;
59 virtual void do_field_string (int fldno, int width, ui_align align,
cbe56571
TT
60 const char *fldname, const char *string,
61 ui_out_style_kind style) override;
112e8700
SM
62 virtual void do_field_fmt (int fldno, int width, ui_align align,
63 const char *fldname, const char *format, va_list args)
64 override ATTRIBUTE_PRINTF (6,0);
65 virtual void do_spaces (int numspaces) override;
66 virtual void do_text (const char *string) override;
67 virtual void do_message (const char *format, va_list args) override
68 ATTRIBUTE_PRINTF (2,0);
69 virtual void do_wrap_hint (const char *identstring) override;
70 virtual void do_flush () override;
7becfd03 71 virtual void do_redirect (struct ui_file *outstream) override;
112e8700 72
4904c3c6 73 virtual bool do_is_mi_like_p () const override
112e8700
SM
74 { return true; }
75
76private:
77
78 void field_separator ();
79 void open (const char *name, ui_out_type type);
80 void close (ui_out_type type);
81
d7e74731
PA
82 /* Convenience method that returns the MI out's string stream cast
83 to its appropriate type. Assumes/asserts that output was not
84 redirected. */
85 string_file *main_stream ();
86
112e8700
SM
87 bool m_suppress_field_separator;
88 bool m_suppress_output;
89 int m_mi_version;
90 std::vector<ui_file *> m_streams;
91};
92
8e5e5494
SM
93/* Create an MI ui-out object with MI version MI_VERSION, which should be equal
94 to one of the INTERP_MI* constants (see interps.h).
95
96 Return nullptr if an invalid version is provided. */
97mi_ui_out *mi_out_new (const char *mi_version);
98
112e8700
SM
99int mi_version (ui_out *uiout);
100void mi_out_put (ui_out *uiout, struct ui_file *stream);
101void mi_out_rewind (ui_out *uiout);
c7ec4050 102
1a5c2598 103#endif /* MI_MI_OUT_H */