AuroraRuntime/Source/IO/Adapters/AuIOAdapterNOPs.cpp
Jamie Reece Wilson 72a3513a04 [+] New stream adapters
[+] IRandomDevice::ToStreamReader
[+] AuIO::Adapters::NewRandomAdapter
[+] AuIO::Adapters::NewNOPsReadAdapter
[+] AuIO::Adapters::NewNOPsSeekingAdapter
[+] AuIO::Adapters::NewNOPsWriteAdapter
[+] AuIO::Adapters::NewZerosReadAdapter
[+] AuIO::Adapters::NewZerosSeekingAdapter
2024-01-03 23:54:46 +00:00

97 lines
2.0 KiB
C++

/***
Copyright (C) 2024 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuIOAdapterNOPs.cpp
Date: 2024-1-3
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "AuIOAdapterNOPs.hpp"
namespace Aurora::IO::Adapters
{
EStreamError NOPsStreamReader::IsOpen()
{
return EStreamError::eErrorNone;
}
EStreamError NOPsStreamReader::Read(const Memory::MemoryViewStreamWrite &parameters)
{
parameters.outVariable = 0;
if (!parameters)
{
return EStreamError::eErrorOutOfBounds;
}
return EStreamError::eErrorNone;
}
void NOPsStreamReader::Close()
{
}
EStreamError NOPsStreamSeekingReader::IsOpen()
{
return EStreamError::eErrorNone;
}
EStreamError NOPsStreamSeekingReader::ArbitraryRead(AuUInt uOffset, const Memory::MemoryViewStreamWrite &parameters)
{
parameters.outVariable = 0;
if (!parameters)
{
return EStreamError::eErrorOutOfBounds;
}
return EStreamError::eErrorNone;
}
void NOPsStreamSeekingReader::Close()
{
}
EStreamError NOPsStreamWriter::IsOpen()
{
return EStreamError::eErrorNone;
}
EStreamError NOPsStreamWriter::Write(const Memory::MemoryViewStreamRead &parameters)
{
if (!parameters)
{
return EStreamError::eErrorOutOfBounds;
}
parameters.outVariable = parameters.length;
return EStreamError::eErrorNone;
}
void NOPsStreamWriter::Close()
{
}
void NOPsStreamWriter::Flush()
{
}
AUKN_SYM AuSPtr<IStreamReader> NewNOPsReadAdapter()
{
SysCheckRetExpNotNullMemory(AuMakeShared<NOPsStreamReader>(), {});
}
AUKN_SYM AuSPtr<ISeekingReader> NewNOPsSeekingAdapter()
{
SysCheckRetExpNotNullMemory(AuMakeShared<NOPsStreamSeekingReader>(), {});
}
AUKN_SYM AuSPtr<IStreamWriter> NewNOPsWriteAdapter()
{
SysCheckRetExpNotNullMemory(AuMakeShared<NOPsStreamWriter>(), {});
}
}