Commit | Line | Data |
---|---|---|
fb40c209 | 1 | /* MI Command Set - MI Console. |
b811d2c2 | 2 | Copyright (C) 2000-2020 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_CONSOLE_H |
21 | #define MI_MI_CONSOLE_H | |
fb40c209 | 22 | |
d7e74731 PA |
23 | /* An output stream for MI. Wraps a given output stream with a prefix |
24 | and handles quoting. This stream is locally buffered. */ | |
fb40c209 | 25 | |
d7e74731 PA |
26 | class mi_console_file : public ui_file |
27 | { | |
28 | public: | |
29 | /* Create a console that wraps the given output stream RAW with the | |
30 | string PREFIX and quoting it with QUOTE. */ | |
31 | mi_console_file (ui_file *raw, const char *prefix, char quote); | |
32 | ||
33 | /* MI-specific API. */ | |
34 | void set_raw (ui_file *raw); | |
35 | ||
36 | /* ui_file-specific methods. */ | |
37 | ||
38 | void flush () override; | |
39 | ||
40 | void write (const char *buf, long length_buf) override; | |
41 | ||
7c4e78cf SM |
42 | void write_async_safe (const char *buf, long length_buf) override; |
43 | ||
d7e74731 PA |
44 | private: |
45 | /* The wrapped raw output stream. */ | |
46 | ui_file *m_raw; | |
47 | ||
48 | /* The local buffer. */ | |
49 | string_file m_buffer; | |
50 | ||
51 | /* The prefix. */ | |
52 | const char *m_prefix; | |
53 | ||
54 | /* The quote char. */ | |
55 | char m_quote; | |
56 | }; | |
37ce89eb | 57 | |
1a5c2598 | 58 | #endif /* MI_MI_CONSOLE_H */ |