gdb/testsuite: make test names unique in gdb.python/py-format-string.exp
[deliverable/binutils-gdb.git] / gdb / ui-out.h
index 2ca43fd69596565e2b7a1ec14e47f5239a425c35..f14be479fa15bfbb275d7f57d9d505b082d1a605 100644 (file)
@@ -1,6 +1,6 @@
 /* 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.
@@ -216,10 +216,10 @@ class ui_out
        uiout->field_signed(), uiout_>field_string() etc. calls when
        the formatted message is translatable.  E.g.:
 
-         uiout->message (_("\nWatchpoint %pF deleted because the program has "
-                         "left the block in\n"
-                         "which its expression is valid.\n"),
-                         signed_field ("wpnum", b->number));
+        uiout->message (_("\nWatchpoint %pF deleted because the program has "
+                        "left the block in\n"
+                        "which its expression is valid.\n"),
+                        signed_field ("wpnum", b->number));
 
      - '%p[' - output the following text in a specified style.
        '%p]' - output the following text in the default style.
@@ -275,6 +275,39 @@ class ui_out
      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)
@@ -309,6 +342,10 @@ class ui_out
   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.  */
 
This page took 0.025383 seconds and 4 git commands to generate.