| 13 | namespace Abyss::FileSystem { |
| 14 | |
| 15 | class CASCStream final : public SizeableStreambuf { |
| 16 | public: |
| 17 | CASCStream(void *casc, const std::string& fileName); |
| 18 | |
| 19 | ~CASCStream() override; |
| 20 | |
| 21 | protected: |
| 22 | int underflow() override; |
| 23 | pos_type seekpos(pos_type pos, std::ios_base::openmode which) override; |
| 24 | pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which) override; |
| 25 | [[nodiscard]] std::streamsize size() const override; |
| 26 | |
| 27 | private: |
| 28 | void *_file = nullptr; |
| 29 | std::streamsize _startOfBlock = 0; |
| 30 | char _buffer[2048] = {}; |
| 31 | }; |
| 32 | |
| 33 | CASCStream::CASCStream(HANDLE storage, const std::string& fileName) { |
| 34 | if (!CascOpenFile(storage, fileName.c_str(), 0, CASC_OPEN_BY_NAME, &_file)) { |
nothing calls this directly
no outgoing calls
no test coverage detected