本文整理汇总了C++中TSharedPtr::CheckOutFile方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedPtr::CheckOutFile方法的具体用法?C++ TSharedPtr::CheckOutFile怎么用?C++ TSharedPtr::CheckOutFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSharedPtr
的用法示例。
在下文中一共展示了TSharedPtr::CheckOutFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteJSONToTextFile
bool UGatherTextCommandletBase::WriteJSONToTextFile(TSharedPtr<FJsonObject> Output, const FString& Filename, TSharedPtr<FGatherTextSCC> SourceControl)
{
bool WasSuccessful = true;
// If the user specified a reference file - write the entries read from code to a ref file
if ( !Filename.IsEmpty() && Output.IsValid() )
{
const bool DidFileExist = FPaths::FileExists(Filename);
if (DidFileExist)
{
if( SourceControl.IsValid() )
{
FText SCCErrorText;
if (!SourceControl->CheckOutFile(Filename, SCCErrorText))
{
UE_LOG(LogGatherTextCommandletBase, Error, TEXT("Check out of file %s failed: %s"), *Filename, *SCCErrorText.ToString());
}
}
}
if( WasSuccessful )
{
//Print the JSON data out to the ref file.
FString OutputString;
TSharedRef< TJsonWriter<> > Writer = TJsonWriterFactory<>::Create( &OutputString );
FJsonSerializer::Serialize( Output.ToSharedRef(), Writer );
if (!FFileHelper::SaveStringToFile(OutputString, *Filename, FFileHelper::EEncodingOptions::ForceUnicode))
{
UE_LOG(LogGatherTextCommandletBase, Error, TEXT("Failed to write localization entries to file %s"), *Filename);
WasSuccessful = false;
}
}
if (!DidFileExist)
{
if( SourceControl.IsValid() )
{
FText SCCErrorText;
if (!SourceControl->CheckOutFile(Filename, SCCErrorText))
{
UE_LOG(LogGatherTextCommandletBase, Error, TEXT("Check out of file %s failed: %s"), *Filename, *SCCErrorText.ToString());
}
}
}
}
else
{
WasSuccessful = false;
}
return WasSuccessful;
}