/*** Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved. File: AuCompressionInterceptor.hpp Date: 2022-9-14 Author: Reece ***/ #pragma once #include namespace Aurora::Compression { struct CompressionInterceptor : ICompressionInterceptor, IO::IStreamReader { CompressionInterceptor(); void Init(const AuSPtr &pStream, const AuSPtr &pBaseStream); bool OnDataAvailable(const AuSPtr &pReadInByteBuffer, const AuSPtr &pWriteOutByteBuffer, const AuSPtr &pProtocolPiece) override; inline virtual IO::EStreamError IsOpen() override; inline virtual IO::EStreamError Read(const Memory::MemoryViewStreamWrite ¶meters) override; inline virtual void Close() override; void FlushNextFrame() override; bool ConfigureAutoFlushPerFrame(bool bAutoFlush) override; bool LimitHasHit() override; void LimitReset() override; void LimitSet(AuUInt uLength) override; bool LimitPassthroughOnOverflow(bool bPassthrough) override; AuUInt LimitGetIndex() override; bool HasFailed() override; private: bool bErrorFlag_ {}; bool bSendFlush_ {}; bool bAutoFlush_ {}; AuSPtr pStream_; AuSPtr pBaseStream_; AuSPtr pLastBuffer_; AuUInt uCountMax_ { AuNumericLimits::max() }; AuUInt uCount_ {}; bool bPassthrough_ {}; }; }