You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb none #lockdown Nick.Penwarden #ROBOMERGE-OWNER: ryan.gerleve #ROBOMERGE-AUTHOR: ben.marsh #ROBOMERGE-SOURCE: CL 4662404 in //UE4/Main/... #ROBOMERGE-BOT: ENGINE (Main -> Dev-Networking) [CL 4662413 by ben marsh in Dev-Networking branch]
66 lines
1.4 KiB
C++
66 lines
1.4 KiB
C++
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "HAL/FileManager.h"
|
|
#include "IMessageAttachment.h"
|
|
|
|
/**
|
|
* Implements a message attachment whose data is held in a file.
|
|
*
|
|
* WARNING: Message attachments do not work yet for out of process messages.
|
|
*/
|
|
class FFileMessageAttachment
|
|
: public IMessageAttachment
|
|
{
|
|
public:
|
|
|
|
/**
|
|
* Creates and initializes a new instance.
|
|
*
|
|
* @param Filename The full name and path of the file.
|
|
*/
|
|
FFileMessageAttachment( const FString& InFilename )
|
|
: AutoDeleteFile(false)
|
|
, Filename(InFilename)
|
|
{ }
|
|
|
|
/**
|
|
* Creates and initializes a new instance.
|
|
*
|
|
* @param Filename The full name and path of the file.
|
|
* @param AutoDeleteFile Whether to delete the file when this attachment is destroyed.
|
|
*/
|
|
FFileMessageAttachment( const FString& InFilename, bool InAutoDeleteFile )
|
|
: AutoDeleteFile(InAutoDeleteFile)
|
|
, Filename(InFilename)
|
|
{ }
|
|
|
|
/** Destructor. */
|
|
~FFileMessageAttachment()
|
|
{
|
|
if (AutoDeleteFile)
|
|
{
|
|
IFileManager::Get().Delete(*Filename);
|
|
}
|
|
}
|
|
|
|
public:
|
|
|
|
// IMessageAttachment interface
|
|
|
|
virtual FArchive* CreateReader() override
|
|
{
|
|
return IFileManager::Get().CreateFileReader(*Filename);
|
|
}
|
|
|
|
private:
|
|
|
|
/** Holds a flag indicating whether the file should be deleted. */
|
|
bool AutoDeleteFile;
|
|
|
|
/** Holds the name of the file that holds the attached data. */
|
|
FString Filename;
|
|
};
|