本文整理汇总了C++中MoveTemp函数的典型用法代码示例。如果您正苦于以下问题:C++ MoveTemp函数的具体用法?C++ MoveTemp怎么用?C++ MoveTemp使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MoveTemp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExtractAssetsToDelete
void FContentDirectoryMonitor::ExtractAssetsToDelete(TArray<FAssetData>& OutAssetsToDelete)
{
for (auto& Deletion : DeletedFiles)
{
for (const auto& AssetData : Utils::FindAssetsPertainingToFile(*Registry, Cache.GetDirectory() + Deletion.Filename.Get()))
{
OutAssetsToDelete.Add(AssetData);
}
// Let the cache know that we've dealt with this change (it will be imported in due course)
Cache.CompleteTransaction(MoveTemp(Deletion));
}
DeletedFiles.Empty();
}
示例2:
virtual FArchive& operator<<(FStringAssetReference& Value) override
{
FArchive& Ar = *this;
FString Path = Value.ToString();
Ar << Path;
if (IsLoading())
{
Value.SetPath(MoveTemp(Path));
}
return Ar;
}
示例3: CreateTextTokenFromUnquotedString
/** Given a potential string, we produce a final FTextToken for it using the correct comparison mode (as inferred from the given string) */
FTextToken CreateTextTokenFromUnquotedString(FString InString)
{
ETextFilterTextComparisonMode TextComparisonMode = ETextFilterTextComparisonMode::Partial;
// The final string may embed the TextCmpExact (+) operator, or the TextCmpAnchor operators (...) - test for those now so we can use the correct comparison mode
if (InString.Len() > 0 && InString[0] == '+')
{
// Matched TextCmpExact - update the comparison mode and remove the + token from the start of the string
TextComparisonMode = ETextFilterTextComparisonMode::Exact;
InString.RemoveAt(0, 1, false);
}
else if (InString.Len() > 2 && InString.StartsWith(TEXT("..."), ESearchCase::CaseSensitive))
{
// Matched TextCmpAnchor (pre-unary) - update the comparison mode and remove the ... token from the start of the string
TextComparisonMode = ETextFilterTextComparisonMode::EndsWith;
InString.RemoveAt(0, 3, false);
}
else if (InString.Len() > 2 && InString.EndsWith(TEXT("..."), ESearchCase::CaseSensitive))
{
// Matched TextCmpAnchor (post-unary) - update the comparison mode and remove the ... token from the end of the string
TextComparisonMode = ETextFilterTextComparisonMode::StartsWith;
InString.RemoveAt(InString.Len() - 3, 3, false);
}
// To preserve behavior with the old text filter, the final string may also contain a TextCmpInvert (-) operator (after stripping the TextCmpExact or TextCmpAnchor tokens from the start)
FTextToken::EInvertResult InvertResult = FTextToken::EInvertResult::No;
if (InString.Len() > 0 && InString[0] == '-')
{
// Matched TextCmpInvert - remove the - token from the start of the string
InvertResult = FTextToken::EInvertResult::Yes;
InString.RemoveAt(0, 1, false);
}
// Finally, if our string starts and ends with a quote, we need to strip those off now
if (InString.Len() > 1 && (InString[0] == '"' || InString[0] == '\''))
{
const TCHAR QuoteChar = InString[0];
if (InString[InString.Len() - 1] == QuoteChar)
{
// Remove the quotes
InString.RemoveAt(0, 1, false);
InString.RemoveAt(InString.Len() - 1, 1, false);
}
}
return FTextToken(MoveTemp(InString), TextComparisonMode, InvertResult);
}
示例4: GET_MEMBER_NAME_CHECKED
TSharedRef<IToolTip> FWidgetTemplateBlueprintClass::GetToolTip() const
{
FText Description;
FString DescriptionStr = WidgetAssetData.GetTagValueRef<FString>( GET_MEMBER_NAME_CHECKED( UBlueprint, BlueprintDescription ) );
if ( !DescriptionStr.IsEmpty() )
{
DescriptionStr.ReplaceInline( TEXT( "\\n" ), TEXT( "\n" ) );
Description = FText::FromString( MoveTemp(DescriptionStr) );
}
else
{
Description = Name;
}
return IDocumentation::Get()->CreateToolTip( Description, nullptr, FString( TEXT( "Shared/Types/" ) ) + Name.ToString(), TEXT( "Class" ) );
}
示例5: MoveTemp
void UCreatureAnimationAsset::PostLoad()
{
Super::PostLoad();
if (!creature_filename.IsEmpty() && AssetImportData && AssetImportData->GetSourceData().SourceFiles.Num() == 0)
{
// convert old source file path to proper UE4 Asset data system
FAssetImportInfo Info;
Info.Insert(FAssetImportInfo::FSourceFile(creature_filename));
AssetImportData->SourceData = MoveTemp(Info);
}
if (CreatureZipBinary.Num() != 0 || CreatureFileJSonData.IsEmpty() == false)
{
// load the animation data caches from the json data
GatherAnimationData();
}
}
示例6: UE_LOG_ONLINE
bool FOnlineUserCloudOculus::ReadUserFile(const FUniqueNetId& UserId, const FString& FileName)
{
auto LoggedInPlayerId = OculusSubsystem.GetIdentityInterface()->GetUniquePlayerId(0);
if (!LoggedInPlayerId.IsValid() || UserId != *LoggedInPlayerId)
{
UE_LOG_ONLINE(Warning, TEXT("Can only read data for logged in player"));
return false;
}
FString BucketName;
FString Key;
if (!(FileName.Split(SEPARATOR, &BucketName, &Key)))
{
BucketName = DefaultBucket;
Key = FileName;
}
OculusSubsystem.AddRequestDelegate(
ovr_CloudStorage_Load(TCHAR_TO_UTF8(*BucketName), TCHAR_TO_UTF8(*Key)),
FOculusMessageOnCompleteDelegate::CreateLambda([this, BucketName, Key, LoggedInPlayerId, FileName](ovrMessageHandle Message, bool bIsError)
{
ovrCloudStorageDataHandle response = ovr_Message_GetCloudStorageData(Message);
check(BucketName == UTF8_TO_TCHAR(ovr_CloudStorageData_GetBucket(response)));
check(Key == UTF8_TO_TCHAR(ovr_CloudStorageData_GetKey(response)));
if (bIsError)
{
UE_LOG_ONLINE(Warning, TEXT("Failed to Load: %s%s%s"), *BucketName, *SEPARATOR, *Key);
}
else
{
int64 BlobSize = ovr_CloudStorageData_GetDataSize(response);
const void* RawBlob = ovr_CloudStorageData_GetData(response);
TArray<uint8> Blob;
Blob.Insert(static_cast<const uint8 *>(RawBlob), BlobSize, 0);
ReadCache.Add(FileName, MoveTemp(Blob));
}
TriggerOnReadUserFileCompleteDelegates(!bIsError, *LoggedInPlayerId, FileName);
}));
return true;
}
示例7: MoveTemp
void FVideoCaptureProtocol::ProcessFrame(FCapturedFrameData Frame)
{
FVideoFrameData* Payload = Frame.GetPayload<FVideoFrameData>();
const int32 WriterIndex = Payload->WriterIndex;
AVIWriters[WriterIndex]->DropFrames(Payload->Metrics.NumDroppedFrames);
AVIWriters[WriterIndex]->Update(Payload->Metrics.TotalElapsedTime, MoveTemp(Frame.ColorBuffer));
// Finalize previous writers if necessary
for (int32 Index = 0; Index < Payload->WriterIndex; ++Index)
{
TUniquePtr<FAVIWriter>& Writer = AVIWriters[Index];
if (Writer->IsCapturing())
{
Writer->Finalize();
}
}
}
示例8: TEXT
void FVideoCaptureProtocol::ConditionallyCreateWriter(const ICaptureProtocolHost& Host)
{
#if PLATFORM_MAC
static const TCHAR* Extension = TEXT(".mov");
#else
static const TCHAR* Extension = TEXT(".avi");
#endif
FString VideoFilename = Host.GenerateFilename(FFrameMetrics(), Extension);
if (AVIWriters.Num() && VideoFilename == AVIWriters.Last()->Options.OutputFilename)
{
return;
}
Host.EnsureFileWritable(VideoFilename);
UVideoCaptureSettings* CaptureSettings = CastChecked<UVideoCaptureSettings>(InitSettings->ProtocolSettings);
FAVIWriterOptions Options;
Options.OutputFilename = MoveTemp(VideoFilename);
Options.CaptureFPS = Host.GetCaptureFrequency();
Options.CodecName = CaptureSettings->VideoCodec;
Options.bSynchronizeFrames = Host.GetCaptureStrategy().ShouldSynchronizeFrames();
Options.Width = InitSettings->DesiredSize.X;
Options.Height = InitSettings->DesiredSize.Y;
if (CaptureSettings->bUseCompression)
{
Options.CompressionQuality = CaptureSettings->CompressionQuality / 100.f;
float QualityOverride = 100.f;
if (FParse::Value( FCommandLine::Get(), TEXT( "-MovieQuality=" ), QualityOverride ))
{
Options.CompressionQuality = FMath::Clamp(QualityOverride, 1.f, 100.f) / 100.f;
}
Options.CompressionQuality = FMath::Clamp<float>(Options.CompressionQuality.GetValue(), 0.f, 1.f);
}
AVIWriters.Emplace(FAVIWriter::CreateInstance(Options));
AVIWriters.Last()->Initialize();
}
示例9: GetTypeName
bool FStringAssetReference::SerializeFromMismatchedTag(struct FPropertyTag const& Tag, FArchive& Ar)
{
struct UObjectTypePolicy
{
typedef UObject Type;
static const FName FORCEINLINE GetTypeName() { return NAME_ObjectProperty; }
};
FString Path = ToString();
bool bReturn = SerializeFromMismatchedTagTemplate<UObjectTypePolicy>(Path, Tag, Ar);
if (Ar.IsLoading())
{
SetPath(MoveTemp(Path));
}
return bReturn;
}
示例10: AddDirectoriesToCommit
/**
* Helper function for FCheckInWorker::Execute.
* Makes sure directories are committed with files that are also marked for add.
* If we don't do this, the commit will fail.
*/
static void AddDirectoriesToCommit(const FSubversionSourceControlCommand& InCommand, TArray<FString>& InOutFiles)
{
// because of the use of "--parents" when we mark for add, we can just traverse up
// the directory tree until we meet a directory that isn't already marked for add
TArray<FString> Directories;
FString WorkingCopyRoot = InCommand.WorkingCopyRoot;
FPaths::NormalizeDirectoryName(WorkingCopyRoot);
for(const auto& Filename : InOutFiles)
{
FString Directory = FPaths::GetPath(Filename);
FPaths::NormalizeDirectoryName(Directory);
// Stop once we leave our working copy, or find a directory that isn't marked for add
while(Directory.StartsWith(WorkingCopyRoot))
{
// Stop if we've already processed this directory, or if this directory isn't marked for add
if(Directories.Contains(Directory) || !IsDirectoryAdded(InCommand, Directory))
{
break;
}
Directories.Add(Directory);
// Chop off the end of this directory to move up to our parent directory
// This is safe to do since we called NormalizeDirectoryName on it, and we're testing to make sure we stay within the working copy
int32 ChopPoint = INDEX_NONE;
if(Directory.FindLastChar('/', ChopPoint))
{
Directory = Directory.Left(ChopPoint);
}
else
{
// No more path to process
break;
}
}
}
InOutFiles.Append(MoveTemp(Directories));
}
示例11: SetupView
virtual void SetupView(FSceneViewFamily& InViewFamily, FSceneView& InView)
{
if (!bNeedsCapture)
{
return;
}
InView.FinalPostProcessSettings.bBufferVisualizationDumpRequired = true;
InView.FinalPostProcessSettings.BufferVisualizationOverviewMaterials.Empty();
InView.FinalPostProcessSettings.BufferVisualizationDumpBaseFilename = MoveTemp(OutputFilename);
struct FIterator
{
FFinalPostProcessSettings& FinalPostProcessSettings;
const TArray<FString>& RenderPasses;
FIterator(FFinalPostProcessSettings& InFinalPostProcessSettings, const TArray<FString>& InRenderPasses)
: FinalPostProcessSettings(InFinalPostProcessSettings), RenderPasses(InRenderPasses)
{}
void ProcessValue(const FString& InName, UMaterial* Material, const FText& InText)
{
if (!RenderPasses.Num() || RenderPasses.Contains(InName) || RenderPasses.Contains(InText.ToString()))
{
FinalPostProcessSettings.BufferVisualizationOverviewMaterials.Add(Material);
}
}
} Iterator(InView.FinalPostProcessSettings, RenderPasses);
GetBufferVisualizationData().IterateOverAvailableMaterials(Iterator);
if (PostProcessingMaterial)
{
FWeightedBlendable Blendable(1.f, PostProcessingMaterial);
PostProcessingMaterial->OverrideBlendableSettings(InView, 1.f);
}
// Ensure we're rendering at full size
InView.ViewRect = InView.UnscaledViewRect;
bNeedsCapture = false;
}
示例12: TEXT
bool FStringAssetReference::ImportTextItem(const TCHAR*& Buffer, int32 PortFlags, UObject* Parent, FOutputDevice* ErrorText)
{
FString ImportedPath = TEXT("");
const TCHAR* NewBuffer = UPropertyHelpers::ReadToken(Buffer, ImportedPath, 1);
if (!NewBuffer)
{
return false;
}
Buffer = NewBuffer;
if (ImportedPath == TEXT("None"))
{
ImportedPath = TEXT("");
}
else
{
if (*Buffer == TCHAR('\''))
{
NewBuffer = UPropertyHelpers::ReadToken(Buffer, ImportedPath, 1);
if (!NewBuffer)
{
return false;
}
Buffer = NewBuffer;
if (*Buffer++ != TCHAR('\''))
{
return false;
}
}
}
SetPath(MoveTemp(ImportedPath));
#if WITH_EDITOR
// Consider this a load, so Config string asset references get cooked
if (FCoreUObjectDelegates::StringAssetReferenceLoaded.IsBound())
{
FCoreUObjectDelegates::StringAssetReferenceLoaded.Execute(ToString());
}
#endif // WITH_EDITOR
return true;
}
示例13: Finalize
void Finalize()
{
TArray<uint8> FinalData;
FMemoryWriter NameTableWriter(FinalData);
int32 NumNames = FNameIndexLookup.Num();
check(NumNames <= MANIFEST_MAX_NAMES);
NameTableWriter << NumNames;
for (auto& MapEntry : FNameIndexLookup)
{
FName& Name = MapEntry.Key;
int32& Index = MapEntry.Value;
NameTableWriter << Name;
NameTableWriter << Index;
}
FinalData.Append(Bytes);
Bytes = MoveTemp(FinalData);
}
示例14: FTimespan
void FContentDirectoryMonitor::Tick()
{
Cache.Tick();
// Immediately resolve any changes that we should not consider
const FDateTime Threshold = FDateTime::UtcNow() - FTimespan(0, 0, GetDefault<UEditorLoadingSavingSettings>()->AutoReimportThreshold);
TArray<DirectoryWatcher::FUpdateCacheTransaction> InsignificantTransactions = Cache.FilterOutstandingChanges([=](const DirectoryWatcher::FUpdateCacheTransaction& Transaction, const FDateTime& TimeOfChange){
return TimeOfChange <= Threshold && !ShouldConsiderChange(Transaction);
});
for (DirectoryWatcher::FUpdateCacheTransaction& Transaction : InsignificantTransactions)
{
Cache.CompleteTransaction(MoveTemp(Transaction));
}
const double Now = FPlatformTime::Seconds();
if (Now - LastSaveTime > ResaveIntervalS)
{
LastSaveTime = Now;
Cache.WriteCache();
}
}
示例15: FromJson
void UAssetImportData::Serialize(FArchive& Ar)
{
if (Ar.UE4Ver() >= VER_UE4_ASSET_IMPORT_DATA_AS_JSON)
{
FString Json;
if (Ar.IsLoading())
{
Ar << Json;
TOptional<FAssetImportInfo> Copy = FromJson(MoveTemp(Json));
if (Copy.IsSet())
{
CopyFrom(Copy.GetValue());
}
}
else if (Ar.IsSaving())
{
Json = ToJson();
Ar << Json;
}
}
Super::Serialize(Ar);
}