* GetProgressBar constructs a progress bar with 5% intervals. * * @param[in] progress The proportion of the progress bar to be filled between 0 and 1. * @param[out] progress_bar String representation of the progress bar. */
| 925 | * @param[out] progress_bar String representation of the progress bar. |
| 926 | */ |
| 927 | static void GetProgressBar(double progress, std::string& progress_bar) |
| 928 | { |
| 929 | if (progress < 0 || progress > 1) return; |
| 930 | |
| 931 | static constexpr double INCREMENT{0.05}; |
| 932 | static const std::string COMPLETE_BAR{"\u2592"}; |
| 933 | static const std::string INCOMPLETE_BAR{"\u2591"}; |
| 934 | |
| 935 | for (int i = 0; i < progress / INCREMENT; ++i) { |
| 936 | progress_bar += COMPLETE_BAR; |
| 937 | } |
| 938 | |
| 939 | for (int i = 0; i < (1 - progress) / INCREMENT; ++i) { |
| 940 | progress_bar += INCOMPLETE_BAR; |
| 941 | } |
| 942 | } |
| 943 | |
| 944 | /** |
| 945 | * ParseGetInfoResult takes in -getinfo result in UniValue object and parses it |
no outgoing calls
no test coverage detected