mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 02:24:17 +08:00
Simplify the ui-out progress API
I noticed that 'progress' is a method on ui-out, but it seems to me that it would be better if the only API were via the progress_meter class. This patch makes this change, changing progress to be a method on the meter itself.
This commit is contained in:
@ -129,7 +129,7 @@ progressfn (debuginfod_client *c, long cur, long total)
|
|||||||
data->meter.emplace (current_uiout, message, 1);
|
data->meter.emplace (current_uiout, message, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
current_uiout->progress ((double)cur / (double)total);
|
data->meter->progress ((double)cur / (double)total);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
14
gdb/ui-out.h
14
gdb/ui-out.h
@ -301,18 +301,18 @@ class ui_out
|
|||||||
progress_meter (const progress_meter &) = delete;
|
progress_meter (const progress_meter &) = delete;
|
||||||
progress_meter &operator= (const progress_meter &) = delete;
|
progress_meter &operator= (const progress_meter &) = delete;
|
||||||
|
|
||||||
|
/* Emit some progress for this progress meter. HOWMUCH may range
|
||||||
|
from 0.0 to 1.0. */
|
||||||
|
void progress (double howmuch)
|
||||||
|
{
|
||||||
|
m_uiout->do_progress_notify (howmuch);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
struct ui_out *m_uiout;
|
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:
|
protected:
|
||||||
|
|
||||||
virtual void do_table_begin (int nbrofcols, int nr_rows, const char *tblid)
|
virtual void do_table_begin (int nbrofcols, int nr_rows, const char *tblid)
|
||||||
|
Reference in New Issue
Block a user