|
Libosmium
Fast and flexible C++ library for working with OpenStreetMap data
|
#include <progress_bar.hpp>
Public Member Functions | |
| ProgressBar (std::size_t max_size, bool enable) noexcept | |
| ProgressBar (const ProgressBar &)=delete | |
| ProgressBar & | operator= (const ProgressBar &)=delete |
| ProgressBar (ProgressBar &&) noexcept=default | |
| ProgressBar & | operator= (ProgressBar &&)=default |
| ~ProgressBar () | |
| void | update (std::size_t current_size) |
| void | file_done (std::size_t file_size) |
| void | done () |
| void | remove () |
Private Types | |
| enum | { full_length = 70 } |
Private Member Functions | |
| void | display () |
Static Private Member Functions | |
| static const char * | bar (std::size_t len=full_length) noexcept |
| static const char * | spc (std::size_t len=full_length) noexcept |
Private Attributes | |
| std::size_t | m_max_size |
| std::size_t | m_done_size = 0 |
| std::size_t | m_current_size = 0 |
| std::size_t | m_prev_percent = 100 + 1 |
| bool | m_enable |
| bool | m_do_cleanup = true |
Displays a progress bar on STDERR. Can be used together with the osmium::io::Reader class for instance.
|
inlinenoexcept |
Initializes the progress bar. No output yet.
| max_size | Max size equivalent to 100%. |
| enable | Set to false to disable (for instance if stderr is not a TTY). |
|
delete |
|
defaultnoexcept |
|
inline |
|
inlinestaticprivatenoexcept |
|
inlineprivate |
|
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.
|
inline |
If you are reading multiple files, call this function after each file is finished.
| file_size | The size of the file just finished. |
|
delete |
|
default |
|
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.
|
inlinestaticprivatenoexcept |
|
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.
| current_size | Current size. Used together with the max_size from constructor to calculate the percentage. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |