本文整理汇总了C++中TArray::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ TArray::Append方法的具体用法?C++ TArray::Append怎么用?C++ TArray::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TArray
的用法示例。
在下文中一共展示了TArray::Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAndTrimSearchResults
bool FAssetDataGatherer::GetAndTrimSearchResults(TArray<FAssetData*>& OutAssetResults, TArray<FString>& OutPathResults, TArray<FPackageDependencyData>& OutDependencyResults, TArray<FString>& OutCookedPackageNamesWithoutAssetDataResults, TArray<double>& OutSearchTimes, int32& OutNumFilesToSearch, int32& OutNumPathsToSearch, bool& OutIsDiscoveringFiles)
{
FScopeLock CritSectionLock(&WorkerThreadCriticalSection);
OutAssetResults.Append(MoveTemp(AssetResults));
AssetResults.Reset();
OutPathResults.Append(MoveTemp(DiscoveredPaths));
DiscoveredPaths.Reset();
OutDependencyResults.Append(MoveTemp(DependencyResults));
DependencyResults.Reset();
OutCookedPackageNamesWithoutAssetDataResults.Append(MoveTemp(CookedPackageNamesWithoutAssetDataResults));
CookedPackageNamesWithoutAssetDataResults.Reset();
OutSearchTimes.Append(MoveTemp(SearchTimes));
SearchTimes.Reset();
OutNumFilesToSearch = FilesToSearch.Num();
OutNumPathsToSearch = NumPathsToSearchAtLastSyncPoint;
OutIsDiscoveringFiles = bIsDiscoveringFiles;
return (SearchStartTime > 0 || bIsDiscoveringFiles);
}
示例2: GetNavigationLinksArray
bool ANavLinkProxy::GetNavigationLinksArray(TArray<FNavigationLink>& OutLink, TArray<FNavigationSegmentLink>& OutSegments) const
{
OutLink.Append(PointLinks);
OutSegments.Append(SegmentLinks);
return (PointLinks.Num() > 0) || (SegmentLinks.Num() > 0);
}
示例3: CopySetupFilesIntoProject
void FIOSTargetSettingsCustomization::CopySetupFilesIntoProject()
{
// First copy the plist, it must get copied
FText ErrorMessage;
if (!SourceControlHelpers::CopyFileUnderSourceControl(GameInfoPath, EngineInfoPath, LOCTEXT("InfoPlist", "Info.plist"), /*out*/ ErrorMessage))
{
FNotificationInfo Info(ErrorMessage);
Info.ExpireDuration = 3.0f;
FSlateNotificationManager::Get().AddNotification(Info);
}
else
{
// Now try to copy all of the icons, etc... (these can be ignored if the file already exists)
TArray<FPlatformIconInfo> Graphics;
Graphics.Empty(IconNames.Num() + LaunchImageNames.Num());
Graphics.Append(IconNames);
Graphics.Append(LaunchImageNames);
for (const FPlatformIconInfo& Info : Graphics)
{
const FString EngineImagePath = EngineGraphicsPath / Info.IconPath;
const FString ProjectImagePath = GameGraphicsPath / Info.IconPath;
if (!FPaths::FileExists(ProjectImagePath))
{
SourceControlHelpers::CopyFileUnderSourceControl(ProjectImagePath, EngineImagePath, Info.IconName, /*out*/ ErrorMessage);
}
}
}
SavedLayoutBuilder->ForceRefreshDetails();
}
示例4: FVector
// Sets default values
AProcTriangle::AProcTriangle()
{
USphereComponent* SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"));
RootComponent = SphereComponent;
UProceduralMeshComponent* mesh = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("GeneratedMesh"));
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
TArray<FVector> p = equilateral_triangle(1,1000.0, FVector(0, 0, 0));
p.Append(triforce_of_triangle(1, 1000.0, FVector(0, 0, 0)));
p.Append(triforce_of_triangle(1, 1000.0/2, FVector(0, 0, 0)));
p.Append(triforce_of_triangle(1, 1000.0/4, FVector(0, 0, 0)));
p.Append(triforce_of_triangle(1, 1000.0/8, FVector(0, 0, 0)));
p.Append(triforce_of_triangle(1, 1000.0/16, FVector(0, 0, 0)));
TArray<int32> triangles = all_triangles(3*5);
// With default options
//mesh->CreateMeshSection(1, vertices, Triangles, TArray<FVector>(), TArray<FVector2D>(), TArray<FColor>(), TArray<FProcMeshTangent>(), false);
mesh->CreateMeshSection(1, p, triangles, TArray<FVector>(), TArray<FVector2D>(), TArray<FColor>(), TArray<FProcMeshTangent>(), false);
mesh->AttachTo(RootComponent);
}
示例5: GetNavigationLinksArray
bool ANavLinkProxy::GetNavigationLinksArray(TArray<FNavigationLink>& OutLink, TArray<FNavigationSegmentLink>& OutSegments) const
{
OutLink.Append(PointLinks);
OutSegments.Append(SegmentLinks);
if (SmartLinkComp->IsNavigationRelevant())
{
OutLink.Add(SmartLinkComp->GetLink());
}
return (PointLinks.Num() > 0) || (SegmentLinks.Num() > 0) || SmartLinkComp->IsNavigationRelevant();
}
示例6: IsUnexposedMemberAction
//------------------------------------------------------------------------------
static bool BlueprintActionMenuUtilsImpl::IsUnexposedMemberAction(FBlueprintActionFilter const& Filter, FBlueprintActionInfo& BlueprintAction)
{
bool bIsFliteredOut = false;
if (UFunction const* Function = BlueprintAction.GetAssociatedFunction())
{
TArray<FString> AllExposedCategories;
for (TWeakObjectPtr<UObject> Binding : BlueprintAction.GetBindings())
{
if (UProperty* Property = Cast<UProperty>(Binding.Get()))
{
FString const ExposedCategoryMetadata = Property->GetMetaData(FBlueprintMetadata::MD_ExposeFunctionCategories);
if (ExposedCategoryMetadata.IsEmpty())
{
continue;
}
TArray<FString> PropertyExposedCategories;
ExposedCategoryMetadata.ParseIntoArray(PropertyExposedCategories, TEXT(","), true);
AllExposedCategories.Append(PropertyExposedCategories);
}
}
FString FunctionCategory = Function->GetMetaData(FBlueprintMetadata::MD_FunctionCategory);
bIsFliteredOut = !AllExposedCategories.Contains(FunctionCategory);
}
return bIsFliteredOut;
}
示例7:
TArray<FString> UCardDeckModel::GetDeckAffinities() const
{
TArray<FString> Affinities;
Affinities.Add(TEXT("Universal"));
Affinities.Append(HeroModel->Affinities);
return Affinities;
}
示例8: GenerateModuleSourceFiles
//------------------------------------------------------------------------------
static bool BlueprintNativeCodeGenUtilsImpl::GenerateModuleSourceFiles(const FBlueprintNativeCodeGenPaths& TargetPaths)
{
FText FailureReason;
TArray<FString> PchIncludes;
PchIncludes.Add(EngineHeaderFile);
PchIncludes.Add(TEXT("GeneratedCodeHelpers.h"));
TArray<FString> FilesToIncludeInModuleHeader;
GConfig->GetArray(TEXT("BlueprintNativizationSettings"), TEXT("FilesToIncludeInModuleHeader"), FilesToIncludeInModuleHeader, GEditorIni);
PchIncludes.Append(FilesToIncludeInModuleHeader);
bool bSuccess = GameProjectUtils::GeneratePluginModuleHeaderFile(TargetPaths.RuntimeModuleFile(FBlueprintNativeCodeGenPaths::HFile), PchIncludes, FailureReason);
if (bSuccess)
{
const FString NoStartupCode = TEXT("");
bSuccess &= GameProjectUtils::GeneratePluginModuleCPPFile(TargetPaths.RuntimeModuleFile(FBlueprintNativeCodeGenPaths::CppFile),
TargetPaths.RuntimeModuleName(), NoStartupCode, FailureReason);
}
if (!bSuccess)
{
UE_LOG(LogBlueprintCodeGen, Error, TEXT("Failed to generate module source files: %s"), *FailureReason.ToString());
}
return bSuccess;
}
示例9: HandleSaveCommandExecute
void SVisualLogger::HandleSaveCommandExecute()
{
TArray<TSharedPtr<class STimeline> > OutTimelines;
MainView->GetTimelines(OutTimelines, true);
if (OutTimelines.Num() == 0)
{
MainView->GetTimelines(OutTimelines);
}
if (OutTimelines.Num())
{
// Prompt the user for the filenames
TArray<FString> SaveFilenames;
IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
bool bSaved = false;
if (DesktopPlatform)
{
void* ParentWindowWindowHandle = NULL;
IMainFrameModule& MainFrameModule = FModuleManager::LoadModuleChecked<IMainFrameModule>(TEXT("MainFrame"));
const TSharedPtr<SWindow>& MainFrameParentWindow = MainFrameModule.GetParentWindow();
if (MainFrameParentWindow.IsValid() && MainFrameParentWindow->GetNativeWindow().IsValid())
{
ParentWindowWindowHandle = MainFrameParentWindow->GetNativeWindow()->GetOSWindowHandle();
}
const FString DefaultBrowsePath = FString::Printf(TEXT("%slogs/"), *FPaths::GameSavedDir());
bSaved = DesktopPlatform->SaveFileDialog(
ParentWindowWindowHandle,
LOCTEXT("NewProjectBrowseTitle", "Choose a project location").ToString(),
DefaultBrowsePath,
TEXT(""),
LogVisualizer::SaveFileTypes,
EFileDialogFlags::None,
SaveFilenames
);
}
if (bSaved)
{
if (SaveFilenames.Num() > 0)
{
TArray<FVisualLogDevice::FVisualLogEntryItem> FrameCache;
for (auto CurrentItem : OutTimelines)
{
FrameCache.Append(CurrentItem->GetEntries());
}
if (FrameCache.Num())
{
FArchive* FileArchive = IFileManager::Get().CreateFileWriter(*SaveFilenames[0]);
FVisualLoggerHelpers::Serialize(*FileArchive, FrameCache);
FileArchive->Close();
delete FileArchive;
FileArchive = NULL;
}
}
}
}
}
示例10: NewPath
TArray<FPropertySoftPath> DiffUtils::GetVisiblePropertiesInOrderDeclared(const UObject* ForObj, const TArray<FName>& Scope /*= TArray<FName>()*/)
{
TArray<FPropertySoftPath> Ret;
if (ForObj)
{
const UClass* Class = ForObj->GetClass();
TSet<FString> HiddenCategories = FEditorCategoryUtils::GetHiddenCategories(Class);
for (TFieldIterator<UProperty> PropertyIt(Class); PropertyIt; ++PropertyIt)
{
FName CategoryName = FObjectEditorUtils::GetCategoryFName(*PropertyIt);
if (!HiddenCategories.Contains(CategoryName.ToString()))
{
if (PropertyIt->PropertyFlags&CPF_Edit)
{
TArray<FName> NewPath(Scope);
NewPath.Push(PropertyIt->GetFName());
if (const UObjectProperty* ObjectProperty = Cast<UObjectProperty>(*PropertyIt))
{
const UObject* const* BaseObject = reinterpret_cast<const UObject* const*>( ObjectProperty->ContainerPtrToValuePtr<void>(ForObj) );
if (BaseObject && *BaseObject)
{
Ret.Append( GetVisiblePropertiesInOrderDeclared(*BaseObject, NewPath) );
}
}
else
{
Ret.Push(NewPath);
}
}
}
}
}
return Ret;
}
示例11: Execute
bool FPerforceCopyWorker::Execute(class FPerforceSourceControlCommand& InCommand)
{
FScopedPerforceConnection ScopedConnection(InCommand);
if (!InCommand.IsCanceled() && ScopedConnection.IsValid())
{
FPerforceConnection& Connection = ScopedConnection.GetConnection();
check(InCommand.Operation->GetName() == GetName());
TSharedRef<FCopy, ESPMode::ThreadSafe> Operation = StaticCastSharedRef<FCopy>(InCommand.Operation);
FString DestinationPath = FPaths::ConvertRelativePathToFull(Operation->GetDestination());
TArray<FString> Parameters;
Parameters.Append(InCommand.Files);
Parameters.Add(DestinationPath);
FP4RecordSet Records;
InCommand.bCommandSuccessful = Connection.RunCommand(TEXT("integrate"), Parameters, Records, InCommand.ErrorMessages, FOnIsCancelled::CreateRaw(&InCommand, &FPerforceSourceControlCommand::IsCanceled), InCommand.bConnectionDropped);
// We now need to do a p4 resolve.
// This is because when we copy a file in the Editor, we first make the copy on disk before attempting to branch. This causes a conflict in P4's eyes.
// We must do this to prevent the asset registry from picking up what it thinks is a newly-added file (which would be created by the p4 integrate command)
// and then the package system getting very confused about where to save the now-duplicated assets.
if(InCommand.bCommandSuccessful)
{
TArray<FString> ResolveParameters;
ResolveParameters.Add(TEXT("-ay")); // 'accept yours'
ResolveParameters.Add(DestinationPath);
InCommand.bCommandSuccessful = Connection.RunCommand(TEXT("resolve"), ResolveParameters, Records, InCommand.ErrorMessages, FOnIsCancelled::CreateRaw(&InCommand, &FPerforceSourceControlCommand::IsCanceled), InCommand.bConnectionDropped);
}
}
return InCommand.bCommandSuccessful;
}
示例12: SendPayloadAndReceiveResponse
bool FTCPTransport::SendPayloadAndReceiveResponse(TArray<uint8>& In, TArray<uint8>& Out)
{
bool SendResult = false;
#if USE_MCSOCKET_FOR_NFS
SendResult = FNFSMessageHeader::WrapAndSendPayload(In, FSimpleAbstractSocket_FMultichannelTCPSocket(MCSocket, NFS_Channels::Main));
#else
SendResult = FNFSMessageHeader::WrapAndSendPayload(In, FSimpleAbstractSocket_FSocket(FileSocket));
#endif
if (!SendResult)
return false;
FArrayReader Response;
bool RetResult = false;
#if USE_MCSOCKET_FOR_NFS
RetResult = FNFSMessageHeader::ReceivePayload(Response, FSimpleAbstractSocket_FMultichannelTCPSocket(MCSocket, NFS_Channels::Main));
#else
RetResult = FNFSMessageHeader::ReceivePayload(Response, FSimpleAbstractSocket_FSocket(FileSocket));
#endif
if (RetResult)
{
Out.Append( Response.GetData(), Response.Num());
return true;
}
return false;
}
示例13: DeserializeFromData
bool FBuildPatchAppManifest::DeserializeFromData(const TArray<uint8>& DataInput)
{
if (DataInput.Num())
{
if (BufferIsJsonManifest(DataInput))
{
FString JsonManifest;
FFileHelper::BufferToString(JsonManifest, DataInput.GetData(), DataInput.Num());
return DeserializeFromJSON(JsonManifest);
}
else
{
FMemoryReader ManifestFile(DataInput);
FManifestFileHeader Header;
ManifestFile << Header;
const int32 SignedHeaderSize = Header.HeaderSize;
if (Header.CheckMagic() && DataInput.Num() > SignedHeaderSize)
{
FSHAHashData DataHash;
FSHA1::HashBuffer(&DataInput[Header.HeaderSize], DataInput.Num() - Header.HeaderSize, DataHash.Hash);
if (DataHash == Header.SHAHash)
{
TArray<uint8> UncompressedData;
if (Header.StoredAs == FChunkHeader::STORED_COMPRESSED && (Header.CompressedSize + Header.HeaderSize) == DataInput.Num())
{
UncompressedData.AddUninitialized(Header.DataSize);
if (!FCompression::UncompressMemory(
static_cast<ECompressionFlags>(COMPRESS_ZLIB | COMPRESS_BiasMemory),
UncompressedData.GetData(),
Header.DataSize,
&DataInput[Header.HeaderSize],
DataInput.Num() - Header.HeaderSize))
{
return false;
}
}
else if ((Header.DataSize + Header.HeaderSize) == DataInput.Num())
{
UncompressedData.Append(&DataInput[Header.HeaderSize], Header.DataSize);
}
else
{
return false;
}
FManifestReader ManifestData(UncompressedData);
return Serialize(ManifestData);
}
else
{
return false;
}
}
else
{
return false;
}
}
}
return false;
}
示例14:
TArray<int32> all_triangles(int n) {
TArray<int32> triangles = triangle_helper(0);
for (int i = 1; i < n; i++) {
triangles.Append(triangle_helper(i));
}
return triangles;
}
示例15: if
static PyObject *py_ue_ihttp_request_set_content(ue_PyIHttpRequest *self, PyObject * args)
{
PyObject *py_obj;
if (!PyArg_ParseTuple(args, "O:set_content", &py_obj))
{
return NULL;
}
if (PyUnicode_Check(py_obj))
{
self->http_request->SetContentAsString(UTF8_TO_TCHAR(PyUnicode_AsUTF8(py_obj)));
}
else if (PyBytes_Check(py_obj))
{
char *buf = nullptr;
Py_ssize_t len = 0;
PyBytes_AsStringAndSize(py_obj, &buf, &len);
TArray<uint8> data;
data.Append((uint8 *)buf, len);
self->http_request->SetContent(data);
}
Py_INCREF(Py_None);
return Py_None;
}