Files
UnrealEngineUWP/Engine/Source/Programs/UnrealTraceServer/src/AsioFile.h
Martin Ridgers f5f368a04f Tidied up some of the per-platform preprocessing
#rnx
#preflight none
(git:6f3d642 - Martin Ridgers - 2023-01-05 15:22:21 +0100)

[CL 23610155 by Martin Ridgers in ue5-main branch]
2023-01-09 04:29:00 -05:00

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 : */