MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / GetProgressBar

Function GetProgressBar

src/bitcoin-cli.cpp:1384–1399  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

1382 * @param[out] progress_bar String representation of the progress bar.
1383 */
1384static 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

Callers 1

ParseGetInfoResultFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected