AuroraRuntime/Source/IO/Adapters/AuIOAdapterNOPs.cpp

97 lines
2.0 KiB
C++
Raw Normal View History

/***
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>(), {});
}
}