AuroraRuntime/Source/IO/IOAdapterSeeking.cpp
Reece 44108a322e 2/3 of the IO update (very early implementation)
[+] TTYConsole::GetPaddingTopOfLog,GetPaddingHeadOfLog,GetPaddingTopOfLog [+ set variants]
[+] IO::IOYield()
[+] IO::IAsyncTransaction::Failed,GetOSErrorCode()
[+] IByteBufferStreamPair
[+] IIOBufferedInterceptor
[+] IIOBufferedProcessor
[+] IIOEventListener
[+] IIOPipeEventListener
[+] IIOProcessorEventListener
[+] IIOProcessorManualInvoker
[+] IIOWaitableIOLoopSource
[+] IIOWaitableIOTimer
[+] IIOWaitableItem
[+] IIOWaitableTickLimiter
[+] IOAdapterAsyncStream
[+] IOAdapterByteBuffer
[+] IOAdapterCompression
[+] IOAdapterSeeking
[*] Cleanup CpuInfo.Linux.cpp
[*] Fixup async threadpool some more
[*] LSTimer.NT.cpp updates timer object on tick state update, akin to Linux
2022-06-12 00:01:27 +01:00

46 lines
1.2 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: IOAdapterSeeking.cpp
Date: 2022-6-6
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include <Aurora/IO/IOExperimental.hpp>
#include "IOAdapterSeeking.hpp"
namespace Aurora::IO
{
SeekingReader::SeekingReader(const AuSPtr<ISeekingReader> &reader) : reader(reader)
{
}
EStreamError SeekingReader::IsOpen()
{
return this->reader ? this->reader->IsOpen() : EStreamError::eErrorStreamNotOpen;
}
EStreamError SeekingReader::Read(const Memory::MemoryViewStreamWrite &parameters)
{
auto error = this->reader ? this->reader->ArbitraryRead(this->index, parameters) : EStreamError::eErrorStreamNotOpen;
if (error == EStreamError::eErrorNone)
{
this->index += parameters.outVariable;
}
return error;
}
void SeekingReader::Close()
{
if (this->reader)
{
this->reader->Close();
}
}
AUKN_SYM AuSPtr<IStreamReader> NewSeekingReadAdapter(const AuSPtr<ISeekingReader> &reader)
{
return AuMakeShared<SeekingReader>(reader);
}
}