本文整理汇总了C++中FOutputDevice::TearDown方法的典型用法代码示例。如果您正苦于以下问题:C++ FOutputDevice::TearDown方法的具体用法?C++ FOutputDevice::TearDown怎么用?C++ FOutputDevice::TearDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FOutputDevice
的用法示例。
在下文中一共展示了FOutputDevice::TearDown方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExportToFileEx
int32 UExporter::ExportToFileEx( FExportToFileParams& ExportParams )
{
#if WITH_EDITOR
check(ExportParams.Object);
CurrentFilename = ExportParams.Filename;
UExporter* Exporter = ExportParams.Exporter;
FString Extension = FPaths::GetExtension(ExportParams.Filename);
int32 Result = 0;
if (!Exporter)
{
// look for an exporter with all possible extensions, so an exporter can have something like *.xxx.yyy as an extension
int32 SearchStart = 0;
int32 DotLocation;
while (!Exporter && (DotLocation = CurrentFilename.Find(TEXT("."), ESearchCase::CaseSensitive, ESearchDir::FromStart, SearchStart)) != INDEX_NONE)
{
// get everything after the current .
Extension = CurrentFilename.Mid(DotLocation + 1);
// try to find an exporter with it
Exporter = FindExporter( ExportParams.Object, *Extension );
// skip past the dot in case we look again
SearchStart = DotLocation + 1;
}
}
if( !Exporter )
{
UE_LOG(LogExporter, Warning, TEXT("No %s exporter found for %s"), *Extension, *(ExportParams.Object->GetFullName()) );
CurrentFilename = TEXT("");
return 0;
}
Exporter->bSelectedOnly = ExportParams.InSelectedOnly;
FOutputDevice* TextBuffer = NULL;
if( Exporter->bText )
{
bool bIsFileDevice = false;
FString TempFile = FPaths::GetPath(ExportParams.Filename);
if (Exporter->bForceFileOperations || ExportParams.bUseFileArchive)
{
IFileManager::Get().MakeDirectory(*TempFile);
TempFile += TEXT("/UnrealExportFile.tmp");
TextBuffer = new FOutputDeviceFile(*TempFile);
if (TextBuffer)
{
TextBuffer->SetSuppressEventTag(true);
TextBuffer->SetAutoEmitLineTerminator(false);
bIsFileDevice = true;
}
}
if (TextBuffer == NULL)
{
if (ExportParams.bUseFileArchive)
{
UE_LOG(LogExporter, Warning, TEXT("Failed to create file output device... defaulting to string buffer"));
}
TextBuffer = new FStringOutputDevice();
}
const FExportObjectInnerContext Context(ExportParams.IgnoreObjectList);
ExportToOutputDevice( &Context, ExportParams.Object, Exporter, *TextBuffer, *Extension, 0, PPF_ExportsNotFullyQualified, ExportParams.InSelectedOnly );
if (bIsFileDevice)
{
TextBuffer->TearDown();
IFileManager::Get().Move(ExportParams.Filename, *TempFile, 1, 1);
}
else
{
FStringOutputDevice& StringBuffer = *((FStringOutputDevice*)TextBuffer);
if ( StringBuffer.Len() == 0 )
{
Result = -1;
}
else
{
if( ExportParams.NoReplaceIdentical )
{
FString FileBytes;
if
( FFileHelper::LoadFileToString(FileBytes,ExportParams.Filename)
&& FCString::Strcmp(*StringBuffer,*FileBytes)==0 )
{
UE_LOG(LogExporter, Log, TEXT("Not replacing %s because identical"), ExportParams.Filename );
Result = 1;
goto Done;
}
if( ExportParams.Prompt )
{
if( !GWarn->YesNof( FText::Format( NSLOCTEXT("Core", "Overwrite", "The file '{0}' needs to be updated. Do you want to overwrite the existing version?"), FText::FromString( ExportParams.Filename ) ) ) )
{
Result = 1;
goto Done;
}
}
//.........这里部分代码省略.........