An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# pbar ![GitHub](https://img.shields.io/github/license/hsuantinglu/pbar) ![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/HsuanTingLu/pbar?include_prereleases)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/HsuanTingLu/pbar)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c0335227c419495fac02ce71c83c60d6)](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

![runtime-demo-GIF](docs/img/runtime_demo.gif)

## Table of Contents
- [Quickstart](#quickstart)
- [Install](#install)


## Quickstart

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
```