#include <progress_bar.hpp>
Displays a progress bar on STDERR. Can be used together with the osmium::io::Reader class for instance.
◆ anonymous enum
◆ ProgressBar() [1/3]
osmium::ProgressBar::ProgressBar |
( |
std::size_t |
max_size, |
|
|
bool |
enable |
|
) |
| |
|
inlinenoexcept |
Initializes the progress bar. No output yet.
- Parameters
-
max_size | Max size equivalent to 100%. |
enable | Set to false to disable (for instance if stderr is not a TTY). |
◆ ProgressBar() [2/3]
osmium::ProgressBar::ProgressBar |
( |
const ProgressBar & |
| ) |
|
|
delete |
◆ ProgressBar() [3/3]
◆ ~ProgressBar()
osmium::ProgressBar::~ProgressBar |
( |
| ) |
|
|
inline |
◆ bar()
static const char * osmium::ProgressBar::bar |
( |
std::size_t |
len = full_length | ) |
|
|
inlinestaticprivatenoexcept |
◆ display()
void osmium::ProgressBar::display |
( |
| ) |
|
|
inlineprivate |
◆ done()
void osmium::ProgressBar::done |
( |
| ) |
|
|
inline |
Call this at the end. Will update the progress bar to 100% and print a final line feed. If this is not called explicitly the destructor will also call this.
◆ file_done()
void osmium::ProgressBar::file_done |
( |
std::size_t |
file_size | ) |
|
|
inline |
If you are reading multiple files, call this function after each file is finished.
- Parameters
-
file_size | The size of the file just finished. |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ remove()
void osmium::ProgressBar::remove |
( |
| ) |
|
|
inline |
Removes the progress bar. Call this before doing any other output. The next time update() is called, the progress bar will be visible again.
◆ spc()
static const char * osmium::ProgressBar::spc |
( |
std::size_t |
len = full_length | ) |
|
|
inlinestaticprivatenoexcept |
◆ update()
void osmium::ProgressBar::update |
( |
std::size_t |
current_size | ) |
|
|
inline |
Call this function to update the progress bar. Actual update will only happen if the percentage changed from the last time this function was called.
- Parameters
-
current_size | Current size. Used together with the max_size from constructor to calculate the percentage. |
◆ m_current_size
std::size_t osmium::ProgressBar::m_current_size = 0 |
|
private |
◆ m_do_cleanup
bool osmium::ProgressBar::m_do_cleanup = true |
|
private |
◆ m_done_size
std::size_t osmium::ProgressBar::m_done_size = 0 |
|
private |
◆ m_enable
bool osmium::ProgressBar::m_enable |
|
private |
◆ m_max_size
std::size_t osmium::ProgressBar::m_max_size |
|
private |
◆ m_prev_percent
std::size_t osmium::ProgressBar::m_prev_percent = 100 + 1 |
|
private |
The documentation for this class was generated from the following file: