AuroraRuntime/Source/IO/AuIOAdapterByteBuffer.cpp
Reece 4e6f116925 [*] Refactor
[+] IProcessSectionView::GetStart
[+] IProcessSectionView::GetEnd
2022-12-17 20:14:19 +00:00

52 lines
1.3 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuIOAdapterByteBuffer.cpp
Date: 2022-6-6
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include <Aurora/IO/IOExperimental.hpp>
#include "AuIOAdapterByteBuffer.hpp"
namespace Aurora::IO
{
AUKN_SYM AuSPtr<IStreamReader> NewByteBufferReadAdapter(const AuSPtr<Memory::ByteBuffer> &pBuffer)
{
if (!pBuffer)
{
SysPushErrorArg();
return {};
}
return AuMakeShared<Buffered::BlobReader>(pBuffer);
}
AUKN_SYM AuSPtr<ISeekingReader> NewByteBufferLinearSeekableAdapter(const AuSPtr<Memory::ByteBuffer> &pBuffer)
{
if (!pBuffer)
{
SysPushErrorArg();
return {};
}
if (pBuffer->flagCircular)
{
SysPushErrorIO("Seekable buffer must not be circular");
return {};
}
return AuMakeShared<Buffered::BlobSeekableReader>(pBuffer);
}
AUKN_SYM AuSPtr<IStreamWriter> NewByteBufferWriteAdapter(const AuSPtr<Memory::ByteBuffer> &pBuffer)
{
if (!pBuffer)
{
SysPushErrorArg();
return {};
}
return AuMakeShared<Buffered::BlobWriter>(pBuffer);
}
}