|
Console Library 8.0.0
A header-only library that makes C++ simple
|
文件块生成器,按固定大小读取文件块。 More...
#include <gextra.h>
Public Member Functions | |
| FileChunks (const std::string &filename, size_t chunk_size=1024, std::ios_base::openmode mode=std::ios::in) | |
| 构造函数,打开文件并读取第一个数据块。 | |
| bool | done () |
| 检查生成器是否已完成。 | |
| std::string | current () |
| 获取当前数据块。 | |
| void | advance () |
| 向前移动一步,读取下一个数据块。 | |
| Public Member Functions inherited from console::Generator< FileChunks, std::string > | |
| iterator | iter () const |
| 获取生成器的迭代器对象。 | |
| iterator | begin () const |
| 获取开始迭代器。 | |
| iterator | end () const |
| 获取结束迭代器。 | |
| bool | done () |
| 检查生成器是否已完成。 | |
| std::string | current () |
| 获取当前值。 | |
| void | advance () |
| 推进生成器到下一个位置。 | |
Private Attributes | |
| std::shared_ptr< std::ifstream > | file_ |
| std::string | current_chunk_ |
| size_t | chunk_size_ |
Additional Inherited Members | |
| Public Types inherited from console::Generator< FileChunks, std::string > | |
| typedef std::string | value_type |
| 生成器产生的值类型。 | |
文件块生成器,按固定大小读取文件块。
|
inlineexplicit |
构造函数,打开文件并读取第一个数据块。
| filename | 文件名。 |
| chunk_size | 每个数据块的大小,默认为1024字节。 |
| mode | 文件打开模式,默认为std::ios::in。 |
| FileError | 如果文件无法打开。 |
|
inline |
向前移动一步,读取下一个数据块。
|
inline |
获取当前数据块。
|
inline |
检查生成器是否已完成。
|
private |
|
private |
|
private |