Console Library 4.7.0
A header-only library that makes C++ simple
Loading...
Searching...
No Matches
console::Progress< Iter >::iterator Class Reference

进度条的迭代器,负责绘制进度条。 More...

#include <progress.h>

Public Member Functions

 iterator (const ProgressConfig *config, size_t current, size_t total, Iter it)
 构造进度条迭代器。
iteratoroperator++ ()
 前置递增:移动到下一个元素,并更新进度条。
iterator operator++ (int)
 后置递增(调用前置递增)。
bool operator== (const iterator &other) const
 比较迭代器是否相等(通过当前进度索引)。
bool operator!= (const iterator &other) const
 比较迭代器是否不等。
decltype(*it_) operator* () const
 解引用:返回底层迭代器所指向的元素。

Detailed Description

template<class Iter>
class console::Progress< Iter >::iterator

进度条的迭代器,负责绘制进度条。

该迭代器包装了底层迭代器,并在递增时根据已完成比例刷新进度条显示。 绘制频率限制为每 50 毫秒一次,以避免刷新过快。

Constructor & Destructor Documentation

◆ iterator()

template<class Iter>
console::Progress< Iter >::iterator::iterator ( const ProgressConfig * config,
size_t current,
size_t total,
Iter it )
inline

构造进度条迭代器。

Parameters
config进度条配置指针(不能为 nullptr)。
current当前进度索引(0 ~ total)。
total总元素个数。
it底层迭代器。

Member Function Documentation

◆ operator!=()

template<class Iter>
bool console::Progress< Iter >::iterator::operator!= ( const iterator & other) const
inline

比较迭代器是否不等。

◆ operator*()

template<class Iter>
decltype(*it_) console::Progress< Iter >::iterator::operator* ( ) const
inline

解引用:返回底层迭代器所指向的元素。

◆ operator++() [1/2]

template<class Iter>
iterator & console::Progress< Iter >::iterator::operator++ ( )
inline

前置递增:移动到下一个元素,并更新进度条。

◆ operator++() [2/2]

template<class Iter>
iterator console::Progress< Iter >::iterator::operator++ ( int )
inline

后置递增(调用前置递增)。

◆ operator==()

template<class Iter>
bool console::Progress< Iter >::iterator::operator== ( const iterator & other) const
inline

比较迭代器是否相等(通过当前进度索引)。


The documentation for this class was generated from the following file: