MCPcopy Create free account
hub / github.com/Kitware/CMake / UpdateProgress

Method UpdateProgress

Source/CursesDialog/cmCursesMainForm.cxx:447–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445}
446
447void cmCursesMainForm::UpdateProgress(std::string const& msg, float prog)
448{
449 if (prog >= 0) {
450 constexpr int progressBarWidth = 40;
451 int progressBarCompleted = static_cast<int>(progressBarWidth * prog);
452 int percentCompleted = static_cast<int>(100 * prog);
453 this->LastProgress = (percentCompleted < 100 ? " " : "");
454 this->LastProgress += (percentCompleted < 10 ? " " : "");
455 this->LastProgress += std::to_string(percentCompleted) + "% [";
456 this->LastProgress.append(progressBarCompleted, '#');
457 this->LastProgress.append(progressBarWidth - progressBarCompleted, ' ');
458 this->LastProgress += "] " + msg + "...";
459 this->DisplayOutputs(std::string());
460 } else {
461 this->Outputs.emplace_back(msg);
462 this->DisplayOutputs(msg);
463 }
464}
465
466void cmCursesMainForm::Write()
467{

Callers 3

ConfigureMethod · 0.95
GenerateMethod · 0.95
mainFunction · 0.45

Calls 4

DisplayOutputsMethod · 0.95
to_stringFunction · 0.85
appendMethod · 0.80
emplace_backMethod · 0.80

Tested by

no test coverage detected