Jamie Reece Wilson
38bf52e852
[+] Aurora::IO::Adapters::NewMemoryViewWriteSeekableAdapter [*] ViewSeekableReadable -> ViewSeekableReader [+] Aurora::IO::FS::OpenMap [+] Aurora::IO::FS::OpenMapFromSharedHandle
49 lines
1.6 KiB
C++
49 lines
1.6 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::Adapters
|
|
{
|
|
AUKN_SYM AuSPtr<IStreamReader> NewByteBufferReadAdapter(const AuSPtr<Memory::ByteBuffer> &pBuffer)
|
|
{
|
|
SysCheckArgNotNull(pBuffer, {});
|
|
SysCheckRetExpNotNullMemory(AuMakeShared<Buffered::BlobReader>(pBuffer), {});
|
|
}
|
|
|
|
AUKN_SYM AuSPtr<ISeekingReader> NewByteBufferLinearReadSeekableAdapter(const AuSPtr<Memory::ByteBuffer> &pBuffer)
|
|
{
|
|
SysCheckArgNotNull(pBuffer, {});
|
|
if (pBuffer->flagCircular)
|
|
{
|
|
SysPushErrorIO("Seekable buffer must not be circular");
|
|
return {};
|
|
}
|
|
|
|
SysCheckRetExpNotNullMemory(AuMakeShared<Buffered::BlobSeekableReader>(pBuffer), {});
|
|
}
|
|
|
|
AUKN_SYM AuSPtr<ISeekingWriter> NewByteBufferLinearWriteSeekableAdapter(const AuSPtr<Memory::ByteBuffer> &pBuffer)
|
|
{
|
|
SysCheckArgNotNull(pBuffer, {});
|
|
if (pBuffer->flagCircular)
|
|
{
|
|
SysPushErrorIO("Seekable buffer must not be circular");
|
|
return {};
|
|
}
|
|
|
|
SysCheckRetExpNotNullMemory(AuMakeShared<Buffered::BlobSeekableWriter>(pBuffer), {});
|
|
}
|
|
|
|
AUKN_SYM AuSPtr<IStreamWriter> NewByteBufferWriteAdapter(const AuSPtr<Memory::ByteBuffer> &pBuffer)
|
|
{
|
|
SysCheckArgNotNull(pBuffer, {});
|
|
SysCheckRetExpNotNullMemory(AuMakeShared<Buffered::BlobWriter>(pBuffer), {});
|
|
}
|
|
} |