Home | History | Annotate | Line # | Download | only in mi
      1   1.1  christos /* MI Command Set - MI Console.
      2  1.11  christos    Copyright (C) 2000-2024 Free Software Foundation, Inc.
      3   1.1  christos    Contributed by Cygnus Solutions (a Red Hat company).
      4   1.1  christos 
      5   1.1  christos    This file is part of GDB.
      6   1.1  christos 
      7   1.1  christos    This program is free software; you can redistribute it and/or modify
      8   1.1  christos    it under the terms of the GNU General Public License as published by
      9   1.1  christos    the Free Software Foundation; either version 3 of the License, or
     10   1.1  christos    (at your option) any later version.
     11   1.1  christos 
     12   1.1  christos    This program is distributed in the hope that it will be useful,
     13   1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     14   1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15   1.1  christos    GNU General Public License for more details.
     16   1.1  christos 
     17   1.1  christos    You should have received a copy of the GNU General Public License
     18   1.1  christos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     19   1.1  christos 
     20   1.8  christos #ifndef MI_MI_CONSOLE_H
     21   1.8  christos #define MI_MI_CONSOLE_H
     22   1.1  christos 
     23   1.7  christos /* An output stream for MI.  Wraps a given output stream with a prefix
     24   1.7  christos    and handles quoting.  This stream is locally buffered.  */
     25   1.1  christos 
     26   1.7  christos class mi_console_file : public ui_file
     27   1.7  christos {
     28   1.7  christos public:
     29   1.7  christos   /* Create a console that wraps the given output stream RAW with the
     30   1.7  christos      string PREFIX and quoting it with QUOTE.  */
     31   1.7  christos   mi_console_file (ui_file *raw, const char *prefix, char quote);
     32   1.7  christos 
     33   1.7  christos   /* MI-specific API.  */
     34   1.7  christos   void set_raw (ui_file *raw);
     35   1.7  christos 
     36   1.7  christos   /* ui_file-specific methods.  */
     37   1.7  christos 
     38   1.7  christos   void flush () override;
     39   1.7  christos 
     40   1.7  christos   void write (const char *buf, long length_buf) override;
     41   1.7  christos 
     42   1.8  christos   void write_async_safe (const char *buf, long length_buf) override;
     43   1.8  christos 
     44   1.7  christos private:
     45   1.7  christos   /* The wrapped raw output stream.  */
     46   1.7  christos   ui_file *m_raw;
     47   1.7  christos 
     48   1.7  christos   /* The local buffer.  */
     49   1.7  christos   string_file m_buffer;
     50   1.7  christos 
     51   1.7  christos   /* The prefix.  */
     52   1.7  christos   const char *m_prefix;
     53   1.7  christos 
     54   1.7  christos   /* The quote char.  */
     55   1.7  christos   char m_quote;
     56   1.7  christos };
     57   1.1  christos 
     58   1.8  christos #endif /* MI_MI_CONSOLE_H */
     59