https://github.com/moshiba/pbar
Low overhead C++ progress bar
https://github.com/moshiba/pbar
cpp hacktoberfest progress-bar progressbar
Last synced: 6 months ago
JSON representation
Low overhead C++ progress bar
- Host: GitHub
- URL: https://github.com/moshiba/pbar
- Owner: moshiba
- License: gpl-3.0
- Created: 2019-09-25T14:29:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-20T03:00:00.000Z (almost 6 years ago)
- Last Synced: 2024-01-16T11:58:36.290Z (about 2 years ago)
- Topics: cpp, hacktoberfest, progress-bar, progressbar
- Language: C++
- Homepage:
- Size: 238 KB
- Stars: 8
- Watchers: 1
- Forks: 2
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pbar  

[](https://www.codacy.com/manual/HsuanTingLu/pbar?utm_source=github.com&utm_medium=referral&utm_content=HsuanTingLu/pbar&utm_campaign=Badge_Grade)
Low overhead C++ progress bar with a friendly interface

## Table of Contents
- [Quickstart](#quickstart)
- [Install](#install)
The `pbar` library is very easy to use,
with a simple constructor `ProgressBar(${description}, ${total})` and you're ready to go.
Updating the bar is as easy as the construction process, `update(${number})` increases/decreases the bar to whatever number you want.
there are example codes in the `examples/` directory, see [Install](#install) for more information.
### Simple example
```cpp
#include "pbar.hpp"
using namespace pbar;
int main() {
ProgressBar progressbar("outer", 10);
for (int i = 0; i != 10; ++i) {
progressbar.update();
}
}
```
### Nested progress bars
```cpp
#include "pbar.hpp"
using namespace pbar;
constexpr int test_size1 = 10;
constexpr int test_size2 = 10000000;
int main() {
ProgressBar progressbar1("outer", test_size1, true);
for (int i = 0; i != test_size1; ++i) {
ProgressBar progressbar2("inner", test_size2, true);
for (int j = 0; j != test_size2; ++j) {
progressbar2.update();
}
progressbar1.update();
}
}
```
## Install
CMake is the official build system.
### Requirements
- C++11 or higher
- [Ansi-Escape](https://github.com/HsuanTingLu/ansi-escape) library for terminal render control
- CMake 3.5 or higher
```bash
mkdir build; cd build/
# Config and build
cmake .. && make driver
# execute example
./examples/driver
```