diff options
author | Daniel_Burrows@alumni.brown.edu <Daniel_Burrows@alumni.brown.edu> | 2010-05-25 20:55:05 -0700 |
---|---|---|
committer | Daniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu> | 2010-06-08 18:46:13 -0700 |
commit | 4cde1ea90cbe2742ef33b16aa1a0f7c6c6e38c95 (patch) | |
tree | 6ef56f2f1ec2577e1256f5513039813e52d7dece | |
parent | be7362a93965bf496580850c849a0131186f4368 (diff) | |
download | aptitude-4cde1ea90cbe2742ef33b16aa1a0f7c6c6e38c95.tar.gz |
Add a method on progress_info that converts the current progress fraction to an integral percentage.
-rw-r--r-- | src/generic/util/progress_info.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/generic/util/progress_info.h b/src/generic/util/progress_info.h index da340458..0c21ac97 100644 --- a/src/generic/util/progress_info.h +++ b/src/generic/util/progress_info.h @@ -80,6 +80,17 @@ namespace aptitude progress_type get_type() const { return type; } double get_progress_fraction() const { return progress_fraction; } + int get_progress_percent_int() const + { + int rval = (int) (100 * progress_fraction); + + if(rval < 0) + return 0; + else if(rval > 100) + return 100; + else + return rval; + } const std::string &get_progress_status() const { return progress_status; } }; |