* 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. */
| 1382 | * @param[out] progress_bar String representation of the progress bar. |
| 1383 | */ |
| 1384 | static void GetProgressBar(double progress, std::string& progress_bar) |
| 1385 | { |
| 1386 | if (progress < 0 || progress > 1) return; |
| 1387 | |
| 1388 | static constexpr double INCREMENT{0.05}; |
| 1389 | static const std::string COMPLETE_BAR{"\u2592"}; |
| 1390 | static const std::string INCOMPLETE_BAR{"\u2591"}; |
| 1391 | |
| 1392 | for (int i = 0; i < progress / INCREMENT; ++i) { |
| 1393 | progress_bar += COMPLETE_BAR; |
| 1394 | } |
| 1395 | |
| 1396 | for (int i = 0; i < (1 - progress) / INCREMENT; ++i) { |
| 1397 | progress_bar += INCOMPLETE_BAR; |
| 1398 | } |
| 1399 | } |
| 1400 | |
| 1401 | /** |
| 1402 | * ParseGetInfoResult takes in -getinfo result in UniValue object and parses it |
no outgoing calls
no test coverage detected