Thread-safe progress tracker with visual progress bar.
More...
#include <progresstracker.hpp>
|
| static auto | clear_line () noexcept -> void |
| | Clears the current progress line.
|
| |
| static auto | format_duration (std::chrono::seconds duration) noexcept -> std::string |
| | Formats a duration given in seconds into a human-readable string.
|
| |
Thread-safe progress tracker with visual progress bar.
◆ ProgressTracker() [1/3]
| ProgressTracker::ProgressTracker |
( |
std::size_t |
total, |
|
|
Config |
config = {} |
|
) |
| |
|
inlineexplicit |
Constructs a progress tracker.
- Parameters
-
| total | Total number of items to track |
| config | Display configuration |
- Exceptions
-
| std::invalid_argument | if total is 0 |
◆ ~ProgressTracker()
| ProgressTracker::~ProgressTracker |
( |
| ) |
|
|
inlinenoexcept |
◆ ProgressTracker() [2/3]
◆ ProgressTracker() [3/3]
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ increment()
| auto ProgressTracker::increment |
( |
| ) |
-> void |
|
inlinenoexcept |
Increments the progress counter (thread-safe, no immediate display update).
◆ add()
| auto ProgressTracker::add |
( |
std::size_t |
count | ) |
-> void |
|
inlinenoexcept |
Adds multiple items to progress (thread-safe, no immediate display update).
◆ get_processed()
| auto ProgressTracker::get_processed |
( |
| ) |
const -> std::size_t |
|
inlinenoexcept |
Gets current progress count (thread-safe).
◆ get_total()
| auto ProgressTracker::get_total |
( |
| ) |
const -> std::size_t |
|
inlinenoexcept |
Gets total item count (thread-safe).
◆ get_progress()
| auto ProgressTracker::get_progress |
( |
| ) |
const -> double |
|
inlinenoexcept |
Gets current progress ratio [0.0, 1.0] (thread-safe).
◆ start()
| auto ProgressTracker::start |
( |
| ) |
-> void |
|
inlinenoexcept |
Starts the background update thread and shows initial display.
◆ finish()
| auto ProgressTracker::finish |
( |
| ) |
-> void |
|
inlinenoexcept |
Stops the update thread and displays final completion message.
◆ clear_line()
| auto ProgressTracker::clear_line |
( |
| ) |
-> void |
|
inlinestaticnoexcept |
Clears the current progress line.
◆ format_duration()
| auto ProgressTracker::format_duration |
( |
std::chrono::seconds |
duration | ) |
-> std::string |
|
inlinestaticnoexcept |
Formats a duration given in seconds into a human-readable string.
Converts the provided std::chrono::seconds duration into a string representation, typically in the format "HH:MM:SS" or similar, for display purposes.
- Parameters
-
| duration | The duration to format, expressed as std::chrono::seconds. |
- Returns
- A std::string containing the formatted duration.
- Note
- This function does not throw exceptions.
The documentation for this class was generated from the following file: