diff options
Diffstat (limited to 'src/zen/progressbar.h')
| -rw-r--r-- | src/zen/progressbar.h | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/src/zen/progressbar.h b/src/zen/progressbar.h deleted file mode 100644 index b54c009e1..000000000 --- a/src/zen/progressbar.h +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright Epic Games, Inc. All Rights Reserved. - -#pragma once - -#include <zencore/timer.h> -#include <zencore/zencore.h> - -#include <string> - -namespace zen { - -class OperationLogOutput; - -class ProgressBar -{ -public: - struct State - { - bool operator==(const State&) const = default; - std::string Task; - std::string Details; - uint64_t TotalCount = 0; - uint64_t RemainingCount = 0; - uint64_t OptionalElapsedTime = (uint64_t)-1; - enum class EStatus - { - Running, - Aborted, - Paused - }; - EStatus Status = EStatus::Running; - - static EStatus CalculateStatus(bool IsAborted, bool IsPaused) - { - if (IsAborted) - { - return EStatus::Aborted; - } - if (IsPaused) - { - return EStatus::Paused; - } - return EStatus::Running; - } - }; - - enum class Mode - { - Plain, - Pretty, - Log, - Quiet - }; - - static void SetLogOperationName(Mode InMode, std::string_view Name); - static void SetLogOperationProgress(Mode InMode, uint32_t StepIndex, uint32_t StepCount); - static void PushLogOperation(Mode InMode, std::string_view Name); - static void PopLogOperation(Mode InMode); - - explicit ProgressBar(Mode InMode, std::string_view InSubTask); - ~ProgressBar(); - - void UpdateState(const State& NewState, bool DoLinebreak); - void ForceLinebreak(); - void Finish(); - bool IsSameTask(std::string_view Task) const; - bool HasActiveTask() const; - -private: - const Mode m_Mode; - Stopwatch m_SW; - uint64_t m_LastUpdateMS; - uint64_t m_PausedMS; - State m_State; - const std::string m_SubTask; - size_t m_LastOutputLength = 0; -}; - -uint32_t GetUpdateDelayMS(ProgressBar::Mode InMode); - -OperationLogOutput* CreateConsoleLogOutput(ProgressBar::Mode InMode); - -} // namespace zen |