mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-16 04:18:51 +08:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
936043b7d4 | ||
|
|
c90f375952 | ||
|
|
2241c00bb6 | ||
|
|
bc128814fc | ||
|
|
5a556bf5e2 | ||
|
|
b5c2e78a72 | ||
|
|
4b2635020f | ||
|
|
5751a58477 | ||
|
|
a528d0d683 |
65
.travis.yml
Normal file
65
.travis.yml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
language: generic
|
||||||
|
|
||||||
|
dist: bionic
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- env: CXX=g++-9 CC=gcc-9
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-9
|
||||||
|
sources:
|
||||||
|
- sourceline: 'ppa:ubuntu-toolchain-r/test'
|
||||||
|
- env: CXX=g++-8 CC=gcc-8
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-8
|
||||||
|
- env: CXX=g++-7 CC=gcc-7
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-7
|
||||||
|
- env: CXX=g++-6 CC=gcc-6
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-6
|
||||||
|
- env: CXX=g++-5 CC=gcc-5
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-5
|
||||||
|
|
||||||
|
- env: CXX=clang++-9 CC=clang-9
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-9
|
||||||
|
- libc++-9-dev
|
||||||
|
- libc++abi-9-dev
|
||||||
|
sources:
|
||||||
|
- sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main'
|
||||||
|
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
||||||
|
- env: CXX=clang++-8 CC=clang-8
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-8
|
||||||
|
- libc++-8-dev
|
||||||
|
- libc++abi-8-dev
|
||||||
|
- env: CXX=clang++-7 CC=clang-7
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-7
|
||||||
|
- libc++-7-dev
|
||||||
|
- libc++abi-7-dev
|
||||||
|
|
||||||
|
|
||||||
|
script:
|
||||||
|
- if [[ "$CXX" == clang* ]]; then export CXXFLAGS="-stdlib=libc++"; fi
|
||||||
|
- mkdir build && cd build
|
||||||
|
- cmake -DDEMO=ON -DSAMPLES=ON ..
|
||||||
|
- make
|
||||||
@@ -3,10 +3,13 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
|
<a href="https://travis-ci.com/p-ranav/indicators">
|
||||||
|
<img src="https://travis-ci.com/p-ranav/indicators.svg?branch=master" alt="ci status"/>
|
||||||
|
</a>
|
||||||
<a href="https://github.com/p-ranav/indicators/blob/master/LICENSE">
|
<a href="https://github.com/p-ranav/indicators/blob/master/LICENSE">
|
||||||
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="license"/>
|
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="license"/>
|
||||||
</a>
|
</a>
|
||||||
<img src="https://img.shields.io/badge/version-1.1-blue.svg?cacheSeconds=2592000" alt="version"/>
|
<img src="https://img.shields.io/badge/version-1.2-blue.svg?cacheSeconds=2592000" alt="version"/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
@@ -49,7 +52,7 @@ int main() {
|
|||||||
Here's the general structure of a progress bar:
|
Here's the general structure of a progress bar:
|
||||||
|
|
||||||
```
|
```
|
||||||
{prefix} {start} {fill} {lead} {remaining} {end} {percentage} [{elapsed}<{remaining}?] {postfix}
|
{prefix} {start} {fill} {lead} {remaining} {end} {percentage} [{elapsed}<{remaining}] {postfix}
|
||||||
^^^^^^^^^^^^^ Bar Width ^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^ Bar Width ^^^^^^^^^^^^^^^
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#define NOMINMAX
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -201,7 +202,7 @@ private:
|
|||||||
auto whole_width = std::floor(progress * _bar_width);
|
auto whole_width = std::floor(progress * _bar_width);
|
||||||
auto remainder_width = fmod((progress * _bar_width), 1.0f);
|
auto remainder_width = fmod((progress * _bar_width), 1.0f);
|
||||||
auto part_width = std::floor(remainder_width * lead_characters.size());
|
auto part_width = std::floor(remainder_width * lead_characters.size());
|
||||||
_lead = lead_characters[part_width];
|
_lead = lead_characters[size_t(part_width)];
|
||||||
if ((_bar_width - whole_width - 1) < 0)
|
if ((_bar_width - whole_width - 1) < 0)
|
||||||
_lead = "";
|
_lead = "";
|
||||||
for (size_t i = 0; i < whole_width; ++i)
|
for (size_t i = 0; i < whole_width; ++i)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#define NOMINMAX
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#define NOMINMAX
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|||||||
Reference in New Issue
Block a user