#pragma once #include #include #include "sector.h" #include "slist.h" #include "svector.h" namespace CFCPP { class StreamView { public: StreamView(const SVector §orChain, int sectorSize, Stream stream); StreamView(const SVector §orChain, int sectorSize, std::streamsize length, SList &availableSectors, Stream stream, bool isFatStream = false); void Write(const char *buffer, std::streamsize offset, std::streamsize count); std::streamsize Read(char *buffer, std::streamsize offset, std::streamsize count); std::streamsize Seek(std::streamsize offset, int origin); void SetLength(std::streamsize value); std::streamsize getLength() const; inline SVector& BaseSectorChain() {return sectorChain;} int ReadInt32(); void WriteInt32(int val); private: void adjustLength(std::streamsize value); void adjustLength(std::streamsize value, SList &availableSectors); private: int sectorSize; std::streamsize length; SVector sectorChain; bool isFatStream = false; int buf = 0; public: Stream stream; SList freeSectors; std::streamsize position; }; }