gdb/testsuite/tui: Always dump_screen when asked
[deliverable/binutils-gdb.git] / gdb / mi / mi-console.h
index 2817c3e3403205b09f236df0c5ca0f3ea1bca603..94cdf2d164323555cea878d98ece5b8dbcd6474d 100644 (file)
@@ -1,5 +1,5 @@
 /* MI Command Set - MI Console.
-   Copyright (C) 2000, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2000-2020 Free Software Foundation, Inc.
    Contributed by Cygnus Solutions (a Red Hat company).
 
    This file is part of GDB.
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#ifndef MI_CONSOLE_H
-#define MI_CONSOLE_H
+#ifndef MI_MI_CONSOLE_H
+#define MI_MI_CONSOLE_H
 
-extern struct ui_file *mi_console_file_new (struct ui_file *raw,
-                                           const char *prefix,
-                                           char quote);
+/* An output stream for MI.  Wraps a given output stream with a prefix
+   and handles quoting.  This stream is locally buffered.  */
 
-#endif
+class mi_console_file : public ui_file
+{
+public:
+  /* Create a console that wraps the given output stream RAW with the
+     string PREFIX and quoting it with QUOTE.  */
+  mi_console_file (ui_file *raw, const char *prefix, char quote);
+
+  /* MI-specific API.  */
+  void set_raw (ui_file *raw);
+
+  /* ui_file-specific methods.  */
+
+  void flush () override;
+
+  void write (const char *buf, long length_buf) override;
+
+  void write_async_safe (const char *buf, long length_buf) override;
+
+private:
+  /* The wrapped raw output stream.  */
+  ui_file *m_raw;
+
+  /* The local buffer.  */
+  string_file m_buffer;
+
+  /* The prefix.  */
+  const char *m_prefix;
+
+  /* The quote char.  */
+  char m_quote;
+};
+
+#endif /* MI_MI_CONSOLE_H */
This page took 0.026964 seconds and 4 git commands to generate.