mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-15 20:08:53 +08:00
Minor update to API
This commit is contained in:
@@ -25,7 +25,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#pragma once
|
||||
#define NOMINMAX
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <indicators/color.hpp>
|
||||
@@ -39,8 +38,9 @@ template <typename Indicator, size_t count> class MultiProgress {
|
||||
public:
|
||||
MultiProgress() { _bars.reserve(count); }
|
||||
|
||||
void add_progress_bar(Indicator &bar) {
|
||||
_bars.push_back(bar);
|
||||
template <size_t index>
|
||||
typename std::enable_if<(index < count), void>::type insert(Indicator &bar) {
|
||||
_bars.insert(_bars.begin() + index, 1, bar);
|
||||
bar._multi_progress_mode = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ int main() {
|
||||
bar3.set_prefix_text("Progress Bar #3 ");
|
||||
|
||||
indicators::MultiProgress<indicators::BlockProgressBar, 3> bars;
|
||||
bars.add_progress_bar(bar1);
|
||||
bars.add_progress_bar(bar2);
|
||||
bars.add_progress_bar(bar3);
|
||||
bars.insert<0>(bar1);
|
||||
bars.insert<1>(bar2);
|
||||
bars.insert<2>(bar3);
|
||||
|
||||
std::cout << "Multiple Progress Bars:\n";
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ int main() {
|
||||
bar3.set_prefix_text("Progress Bar #3 ");
|
||||
|
||||
indicators::MultiProgress<indicators::ProgressBar, 3> bars;
|
||||
bars.add_progress_bar(bar1);
|
||||
bars.add_progress_bar(bar2);
|
||||
bars.add_progress_bar(bar3);
|
||||
bars.insert<0>(bar1);
|
||||
bars.insert<1>(bar2);
|
||||
bars.insert<1>(bar3);
|
||||
|
||||
std::cout << "Multiple Progress Bars:\n";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user