You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rnx #preflight none (git:6f3d642 - Martin Ridgers - 2023-01-05 15:22:21 +0100) [CL 23610155 by Martin Ridgers in ue5-main branch]
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "Asio.h"
|
|
|
|
#include "AsioIoable.h"
|
|
#include "Foundation.h"
|
|
#if !TS_USING(TS_PLATFORM_WINDOWS)
|
|
#include "asio/posix/stream_descriptor.hpp"
|
|
#endif
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
class FAsioFile
|
|
: public FAsioReadable
|
|
, public FAsioWriteable
|
|
{
|
|
public:
|
|
FAsioFile(asio::io_context& IoContext, uintptr_t OsHandle);
|
|
asio::io_context& GetIoContext();
|
|
static FAsioWriteable* WriteFile(asio::io_context& IoContext, const FPath& Path);
|
|
static FAsioReadable* ReadFile(asio::io_context& IoContext, const FPath& Path);
|
|
virtual bool IsOpen() const override;
|
|
virtual void Close() override;
|
|
virtual bool HasDataAvailable() const override;
|
|
virtual bool Write(const void* Src, uint32 Size, FAsioIoSink* Sink, uint32 Id) override;
|
|
virtual bool Read(void* Dest, uint32 Size, FAsioIoSink* Sink, uint32 Id) override;
|
|
virtual bool ReadSome(void* Dest, uint32 BufferSize, FAsioIoSink* Sink, uint32 Id) override;
|
|
|
|
private:
|
|
using HandleType =
|
|
#if TS_USING(TS_PLATFORM_WINDOWS)
|
|
asio::windows::random_access_handle;
|
|
#else
|
|
asio::posix::stream_descriptor;
|
|
#endif
|
|
|
|
HandleType Handle;
|
|
uint64 Offset = 0;
|
|
};
|
|
|
|
/* vim: set noexpandtab : */
|