/
thomas-king
/
Raze
Обзор
Документация
Войти
/
thomas-king
/
Raze
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
lib/Library/ProgressIndicatorBuilder.cpp
35 строк
844 B
Ace Rodstin
Add progress indicator. Fix caching.
22 ноя 2023, 21:48
22 ноя 2023, 21:48
0b09a0a
Код
Авторство
О чём код?
// // ProgressIndicatorBuilder.cpp // Library // // Created by Ace Rodstin on 11/24/23. // Updated by Ace Rodstin on 11/24/23. // // Copyright (C) Ace Rodstin 2023. All rights reserved. // #include "Library/ProgressIndicatorBuilder.h" using namespace lib; string ProgressIndicatorBuilder::build() const { stringstream result; result << buildOptions.label << " " << "["; int position = int(buildOptions.barWidth * buildOptions.progress); for (int i = 0; i < buildOptions.barWidth; i++) { if (i <= position) { result << "#"; } else { result << " "; } } result << "]" << " " << int(buildOptions.progress * 100) << "%"; return result.str(); } void ProgressIndicatorBuilder::setBuildOptions(BuildOptions buildOptions) { this->buildOptions = buildOptions; }