/* Output generating routines for GDB.
- Copyright (C) 1999-2020 Free Software Foundation, Inc.
+ Copyright (C) 1999-2021 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
Written by Fernando Nasser for Cygnus.
CORE_ADDR address);
void field_string (const char *fldname, const char *string,
const ui_file_style &style = ui_file_style ());
- void field_string (const char *fldname, const std::string &string);
+ void field_string (const char *fldname, const std::string &string,
+ const ui_file_style &style = ui_file_style ())
+ {
+ field_string (fldname, string.c_str (), style);
+ }
void field_stream (const char *fldname, string_file &stream,
const ui_file_style &style = ui_file_style ());
void field_skip (const char *fldname);
void spaces (int numspaces);
void text (const char *string);
+ void text (const std::string &string) { text (string.c_str ()); }
/* Output a printf-style formatted string. In addition to the usual
printf format specs, this supports a few GDB-specific
escapes. */
virtual bool can_emit_style_escape () const = 0;
+ /* An object that starts and finishes a progress meter. */
+ class progress_meter
+ {
+ public:
+ /* SHOULD_PRINT indicates whether something should be printed for a tty. */
+ progress_meter (struct ui_out *uiout, const std::string &name,
+ bool should_print)
+ : m_uiout (uiout)
+ {
+ m_uiout->do_progress_start (name, should_print);
+ }
+
+ ~progress_meter ()
+ {
+ m_uiout->do_progress_notify (1.0);
+ m_uiout->do_progress_end ();
+ }
+
+ progress_meter (const progress_meter &) = delete;
+ progress_meter &operator= (const progress_meter &) = delete;
+
+ private:
+
+ struct ui_out *m_uiout;
+ };
+
+ /* Emit some progress corresponding to the most recently created
+ progress meter. HOWMUCH may range from 0.0 to 1.0. */
+ void progress (double howmuch)
+ {
+ do_progress_notify (howmuch);
+ }
+
protected:
virtual void do_table_begin (int nbrofcols, int nr_rows, const char *tblid)
virtual void do_flush () = 0;
virtual void do_redirect (struct ui_file *outstream) = 0;
+ virtual void do_progress_start (const std::string &, bool) = 0;
+ virtual void do_progress_notify (double) = 0;
+ virtual void do_progress_end () = 0;
+
/* Set as not MI-like by default. It is overridden in subclasses if
necessary. */