68 lines
1.7 KiB
C++
68 lines
1.7 KiB
C++
|
/***
|
||
|
Copyright (C) 2024 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||
|
|
||
|
File: AuIOAdapterZeros.cpp
|
||
|
Date: 2024-1-3
|
||
|
Author: Reece
|
||
|
***/
|
||
|
#include <Source/RuntimeInternal.hpp>
|
||
|
#include "AuIOAdapterZeros.hpp"
|
||
|
|
||
|
namespace Aurora::IO::Adapters
|
||
|
{
|
||
|
EStreamError ZerosStreamReader::IsOpen()
|
||
|
{
|
||
|
return EStreamError::eErrorNone;
|
||
|
}
|
||
|
|
||
|
EStreamError ZerosStreamReader::Read(const Memory::MemoryViewStreamWrite ¶meters)
|
||
|
{
|
||
|
if (!parameters)
|
||
|
{
|
||
|
parameters.outVariable = 0;
|
||
|
return EStreamError::eErrorOutOfBounds;
|
||
|
}
|
||
|
|
||
|
AuMemset(parameters.ptr, 0, parameters.length);
|
||
|
parameters.outVariable = parameters.length;
|
||
|
return EStreamError::eErrorNone;
|
||
|
}
|
||
|
|
||
|
void ZerosStreamReader::Close()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
EStreamError ZerosStreamSeekingReader::IsOpen()
|
||
|
{
|
||
|
return EStreamError::eErrorNone;
|
||
|
}
|
||
|
|
||
|
EStreamError ZerosStreamSeekingReader::ArbitraryRead(AuUInt uOffset, const Memory::MemoryViewStreamWrite ¶meters)
|
||
|
{
|
||
|
if (!parameters)
|
||
|
{
|
||
|
parameters.outVariable = 0;
|
||
|
return EStreamError::eErrorOutOfBounds;
|
||
|
}
|
||
|
|
||
|
AuMemset(parameters.ptr, 0, parameters.length);
|
||
|
parameters.outVariable = parameters.length;
|
||
|
return EStreamError::eErrorNone;
|
||
|
}
|
||
|
|
||
|
void ZerosStreamSeekingReader::Close()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
AUKN_SYM AuSPtr<IStreamReader> NewZerosReadAdapter()
|
||
|
{
|
||
|
SysCheckRetExpNotNullMemory(AuMakeShared<ZerosStreamReader>(), {});
|
||
|
}
|
||
|
|
||
|
AUKN_SYM AuSPtr<ISeekingReader> NewZerosSeekingAdapter()
|
||
|
{
|
||
|
SysCheckRetExpNotNullMemory(AuMakeShared<ZerosStreamSeekingReader>(), {});
|
||
|
}
|
||
|
}
|