You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
assert( bar.config().fixed_length() != 0 ); // The exact value depends on the content of the data member
276
276
```
277
277
278
-
The specific terminal line width (in characters) can be obtained using `pgbar::terminal_width()`. If the passed output stream does not point to an actual terminal device, the return value will be 0.
278
+
The specific terminal line width (in characters) can be obtained using `pgbar::config::terminal_width()`. If the passed output stream does not point to an actual terminal device, the return value will be 0.
279
279
280
280
> If the running platform is neither `Windows` nor `Unix-like`, then this function will only return a fixed value of 100.
// At this point, the progress bar can exactly fill one line.
286
286
```
287
287
#### Data configuration
@@ -356,8 +356,6 @@ int main()
356
356
```
357
357
358
358
Especially it is important to note that the binding to the same output stream objects are not allowed to run at the same time, otherwise it will throw an exception `pgbar::exception::InvalidState`; For a detailed explanation of this, see [FAQ - Design of renderer](#design-of-renderer).
359
-
360
-
If the output stream is not bound to the terminal, the progress bar will not be rendered. You can see this in [Global configuration - Output stream detection](#output-stream-detection).
361
359
#### Rendering strategy
362
360
There are two ways for `ProgressBar` to render the progress bar to the terminal: synchronously (`pgbar::Policy::Sync`) or asynchronously (`pgbar::Policy::Async`); different rendering strategies will hand over the rendering behavior to different threads for execution.
assert( bar.config().fixed_length() != 0 ); // The exact value depends on the content of the data member
696
694
```
697
695
698
-
The specific terminal line width (in characters) can be obtained using `pgbar::terminal_width()`. If the passed output stream does not point to an actual terminal device, the return value will be 0.
696
+
The specific terminal line width (in characters) can be obtained using `pgbar::config::terminal_width()`. If the passed output stream does not point to an actual terminal device, the return value will be 0.
699
697
700
698
> If the running platform is neither `Windows` nor `Unix-like`, then this function will only return a fixed value of 100.
// At this point, the progress bar can exactly fill one line.
706
704
```
707
705
#### Data configuration
@@ -774,8 +772,6 @@ int main()
774
772
```
775
773
776
774
Especially it is important to note that the binding to the same output stream objects are not allowed to run at the same time, otherwise it will throw an exception `pgbar::exception::InvalidState`; For a detailed explanation of this, see [FAQ - Design of renderer](#design-of-renderer).
777
-
778
-
If the output stream is not bound to the terminal, the progress bar will not be rendered. You can see this in [Global configuration - Output stream detection](#output-stream-detection).
779
775
#### Rendering strategy
780
776
There are two ways for `BlockBar` to render the progress bar to the terminal: synchronously (`pgbar::Policy::Sync`) or asynchronously (`pgbar::Policy::Async`); different rendering strategies will hand over the rendering behavior to different threads for execution.
assert( bar.config().fixed_length() != 0 ); // The exact value depends on the content of the data member
1119
1115
```
1120
1116
1121
-
The specific terminal line width (in characters) can be obtained using `pgbar::terminal_width()`. If the passed output stream does not point to an actual terminal device, the return value will be 0.
1117
+
The specific terminal line width (in characters) can be obtained using `pgbar::config::terminal_width()`. If the passed output stream does not point to an actual terminal device, the return value will be 0.
1122
1118
1123
1119
> If the running platform is neither `Windows` nor `Unix-like`, then this function will only return a fixed value of 100.
// At this point, the progress bar can exactly fill one line.
1129
1125
```
1130
1126
#### Data configuration
@@ -1197,8 +1193,6 @@ int main()
1197
1193
```
1198
1194
1199
1195
Especially it is important to note that the binding to the same output stream objects are not allowed to run at the same time, otherwise it will throw an exception `pgbar::exception::InvalidState`; For a detailed explanation of this, see [FAQ - Design of renderer](#design-of-renderer).
1200
-
1201
-
If the output stream is not bound to the terminal, the progress bar will not be rendered. You can see this in [Global configuration - Output stream detection](#output-stream-detection).
1202
1196
#### Rendering strategy
1203
1197
There are two ways for `SweepBar` to render the progress bar to the terminal: synchronously (`pgbar::Policy::Sync`) or asynchronously (`pgbar::Policy::Async`); different rendering strategies will hand over the rendering behavior to different threads for execution.
1204
1198
@@ -1588,8 +1582,6 @@ int main()
1588
1582
```
1589
1583
1590
1584
Especially it is important to note that the binding to the same output stream objects are not allowed to run at the same time, otherwise it will throw an exception `pgbar::exception::InvalidState`; For a detailed explanation of this, see [FAQ - Design of renderer](#design-of-renderer).
1591
-
1592
-
If the output stream is not bound to the terminal, the progress bar will not be rendered. You can see this in [Global configuration - Output stream detection](#output-stream-detection).
1593
1585
#### Rendering strategy
1594
1586
There are two ways for `SpinBar` to render the progress bar to the terminal: synchronously (`pgbar::Policy::Sync`) or asynchronously (`pgbar::Policy::Async`); different rendering strategies will hand over the rendering behavior to different threads for execution.
1595
1587
@@ -1944,7 +1936,7 @@ int main()
1944
1936
pgbar::DynamicBar<> dbar;
1945
1937
1946
1938
auto bar1 = dbar.insert<pgbar::ProgressBar<>>();
1947
-
// bar1, bar2, bar3 are all objects of type std::shared_ptr</* ProgressBar */>.
1939
+
// bar1, bar2 are all objects of type std::shared_ptr</* ProgressBar */>.
@@ -2102,17 +2094,21 @@ Given that `stdout` and `stderr` are redirected to other files, `pgbar` also che
2102
2094
2103
2095
`pgbar` supports checking output stream bindings for Windows and unix-like (actually POSIX-compliant) platforms; For non-Windows and unix-like platforms, `pgbar` will not recognize whether the output stream is bound to the terminal.
2104
2096
2105
-
When `pgbar` finds that an output stream does not point to the terminal, all progress bars pointing to the output stream will not output any information, but the internal exception check work is normal.
2097
+
When `pgbar` detects that an output stream is not directed to a terminal, the coloring effect of all progress bars pointing to that output stream will be automatically disabled, and no additional virtual terminal sequence strings for manipulating the terminal cursor will be inserted.
2098
+
2099
+
Whether the coloring effect is automatically turned off or not can be enabled or disabled by the `pgbar::config::disable_styling()` function.
2100
+
2101
+
When it is enabled (that is, by default), if the progress bar detects that the output stream it is in does not point to a terminal device, it will call the `colored()` and `bolded()` methods of the configuration object to turn off color and font effects.
2106
2102
2107
-
You can also call the `intty()` method in namespace `pgbar` to check if an output stream is pointing to a terminal.
2103
+
You can also call the `intty()` method in namespace `pgbar::config` to check if an output stream is pointing to a terminal.
2108
2104
2109
2105
```cpp
2110
2106
#include "pgbar/pgbar.hpp"
2111
2107
#include <iostream>
2112
2108
2113
2109
int main()
2114
2110
{
2115
-
if ( pgbar::intty( pgbar::Channel::Stdout ) )
2111
+
if ( pgbar::config::intty( pgbar::Channel::Stdout ) )
2116
2112
std::cout << "Standard output is bound to a terminal." << std::endl;
2117
2113
else
2118
2114
std::cout << "Standard output is not bound to a terminal." << std::endl;
0 commit comments