18 static const int BUFFER_SIZE = 4096;
24 static const uint32_t FILE_OPEN_WARN_COUNT = 6;
25 static uint32_t open_file_counter;
27 FileStreamBuf(
const std::string& name,
const std::string& mode);
30 int_type underflow()
override;
32 std::streampos seekpos(
34 std::ios_base::openmode which = std::ios_base::in | std::ios_base::out)
override;
36 std::streampos seekoff(
38 std::ios_base::seekdir way,
39 std::ios_base::openmode which = std::ios_base::in | std::ios_base::out)
override;
41 int_type pbackfail(int_type c = EOF)
override;
48 FILE* filein_ =
nullptr;
49 char buffer_[BUFFER_SIZE];
50 char fbuffer_[BUFFER_SIZE];
52 uint32_t last_read_pos_ = 0;
58 std::istream(buf.get()),
64 return buffer_->file();
67 explicit operator bool()
const {
72 std::shared_ptr<FileStreamBuf> buffer_;