| 552 | StringConsumer consumer; |
| 553 | |
| 554 | size_t ReadInternal(std::span<char> buf) |
| 555 | { |
| 556 | size_t count = buf.size(); |
| 557 | if (this->pos + count > this->size) { |
| 558 | count = this->size - this->pos; |
| 559 | } |
| 560 | if (count > 0) count = fread(buf.data(), 1, count, this->file); |
| 561 | this->pos += count; |
| 562 | return count; |
| 563 | } |
| 564 | |
| 565 | public: |
| 566 | SQFile(FileHandle file, size_t size) : file(std::move(file)), size(size), pos(0), consumer(buffer) {} |