J Reece Wilson
766be57a46
[+] ProcessSectionViewReserved.Unix.cpp [*] Fix missing ::Flush() member on ViewWriter
53 lines
1.6 KiB
C++
53 lines
1.6 KiB
C++
/***
|
|
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 <IO/Protocol/Protocol.hpp>
|
|
|
|
namespace Aurora::Compression
|
|
{
|
|
struct CompressionInterceptor : ICompressionInterceptor, IO::IStreamReader
|
|
{
|
|
CompressionInterceptor();
|
|
|
|
void Init(const AuSPtr<ICompressionStream> &pStream,
|
|
const AuSPtr<BaseStream> &pBaseStream);
|
|
|
|
bool OnDataAvailable(const AuSPtr<Memory::ByteBuffer> &pReadInByteBuffer,
|
|
const AuSPtr<Memory::ByteBuffer> &pWriteOutByteBuffer) 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<ICompressionStream> pStream_;
|
|
AuSPtr<BaseStream> pBaseStream_;
|
|
AuSPtr<Memory::ByteBuffer> pLastBuffer_;
|
|
AuUInt uCountMax_ { AuNumericLimits<AuUInt>::max() };
|
|
AuUInt uCount_ {};
|
|
bool bPassthrough_ {};
|
|
};
|
|
} |