You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rnx #rb none #ROBOMERGE-OWNER: ryan.durand #ROBOMERGE-AUTHOR: ryan.durand #ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900 #ROBOMERGE-BOT: (v613-10869866) [CL 10870549 by ryan durand in Main branch]
66 lines
1.4 KiB
C++
66 lines
1.4 KiB
C++
// Copyright 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;
|
|
};
|