本文整理汇总了C++中TArray::Top方法的典型用法代码示例。如果您正苦于以下问题:C++ TArray::Top方法的具体用法?C++ TArray::Top怎么用?C++ TArray::Top使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TArray
的用法示例。
在下文中一共展示了TArray::Top方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MoveTemp
TArray<FChunkPart> FDataStructure::GetFinalDataStructure()
{
if (DataStructure.Top().PartSize == 0)
{
DataStructure.Pop(false);
}
return MoveTemp(DataStructure);
}
示例2: CompleteCurrentChunk
void FDataStructure::CompleteCurrentChunk()
{
DataStructure.AddZeroed();
FChunkPart& PreviousPart = DataStructure[DataStructure.Num() - 2];
// Create next chunk
NewChunkGuid = FGuid::NewGuid();
DataStructure.Top().DataOffset = PreviousPart.DataOffset + PreviousPart.PartSize;
DataStructure.Top().ChunkGuid = NewChunkGuid;
}
示例3: Construct
void STextPropertyWidget::Construct(const FArguments& Arguments, const TSharedRef<IPropertyHandle>& InPropertyHandle)
{
PropertyHandle = InPropertyHandle;
const auto& GetTextValue = [this]() -> FText
{
FText TextValue;
TArray<const void*> RawData;
PropertyHandle->AccessRawData(RawData);
if (RawData.Num() == 1)
{
const FText* RawDatum = reinterpret_cast<const FText*>(RawData.Top());
if (RawDatum)
{
TextValue = *RawDatum;
}
}
else if(RawData.Num() > 1)
{
TextValue = NSLOCTEXT("PropertyEditor", "MultipleValues", "Multiple Values");
}
else
{
TextValue = FText::GetEmpty();
}
return TextValue;
};
const auto& OnTextCommitted = [this](const FText& NewText, ETextCommit::Type CommitInfo)
{
PropertyHandle->NotifyPreChange();
TArray<void*> RawData;
PropertyHandle->AccessRawData(RawData);
for (void* const RawDatum : RawData)
{
FText& PropertyValue = *(reinterpret_cast<FText* const>(RawDatum));
// FText::FromString on the result of FText::ToString is intentional. For now, we want to nuke any namespace/key info and let it get regenerated from scratch,
// rather than risk adopting whatever came through some chain of calls. This will be replaced when preserving of identity is implemented.
PropertyValue = FText::FromString(NewText.ToString());
}
PropertyHandle->NotifyPostChange();
};
ChildSlot
[
SNew(SEditableTextBox)
.Text_Lambda(GetTextValue)
.OnTextCommitted_Lambda(OnTextCommitted)
];
}
示例4: PushKnownChunk
void FDataStructure::PushKnownChunk(const FGuid& PotentialMatch, uint32 NumDataInWindow)
{
if (DataStructure.Top().PartSize > 0)
{
// Add for matched
DataStructure.AddUninitialized();
// Add for next
DataStructure.AddUninitialized();
// Fill out info
FChunkPart& PreviousChunkPart = DataStructure[DataStructure.Num() - 3];
FChunkPart& MatchedChunkPart = DataStructure[DataStructure.Num() - 2];
FChunkPart& NextChunkPart = DataStructure[DataStructure.Num() - 1];
MatchedChunkPart.DataOffset = PreviousChunkPart.DataOffset + PreviousChunkPart.PartSize;
MatchedChunkPart.PartSize = NumDataInWindow;
MatchedChunkPart.ChunkOffset = 0;
MatchedChunkPart.ChunkGuid = PotentialMatch;
NextChunkPart.DataOffset = MatchedChunkPart.DataOffset + MatchedChunkPart.PartSize;
NextChunkPart.ChunkGuid = PreviousChunkPart.ChunkGuid;
NextChunkPart.ChunkOffset = PreviousChunkPart.ChunkOffset + PreviousChunkPart.PartSize;
NextChunkPart.PartSize = 0;
}
else
{
// Add for next
DataStructure.AddZeroed();
// Fill out info
FChunkPart& MatchedChunkPart = DataStructure[DataStructure.Num() - 2];
FChunkPart& NextChunkPart = DataStructure[DataStructure.Num() - 1];
NextChunkPart.ChunkOffset = MatchedChunkPart.ChunkOffset;
NextChunkPart.ChunkGuid = NewChunkGuid;
NextChunkPart.DataOffset = MatchedChunkPart.DataOffset + NumDataInWindow;
MatchedChunkPart.PartSize = NumDataInWindow;
MatchedChunkPart.ChunkOffset = 0;
MatchedChunkPart.ChunkGuid = PotentialMatch;
}
}
示例5: Construct
void STextPropertyWidget::Construct(const FArguments& InArgs, const TSharedRef<IPropertyHandle>& InPropertyHandle, const TSharedPtr<IPropertyUtilities>& InPropertyUtilities)
{
PropertyHandle = InPropertyHandle;
PropertyUtilities = InPropertyUtilities;
const auto& GetTextValue = [this]() -> FText
{
FText TextValue;
TArray<const void*> RawData;
PropertyHandle->AccessRawData(RawData);
if (RawData.Num() == 1)
{
const FText* RawDatum = reinterpret_cast<const FText*>(RawData.Top());
if (RawDatum)
{
TextValue = *RawDatum;
}
}
else if(RawData.Num() > 1)
{
TextValue = MultipleValuesText;
}
else
{
TextValue = FText::GetEmpty();
}
return TextValue;
};
const auto& OnTextCommitted = [this](const FText& NewText, ETextCommit::Type CommitInfo)
{
TArray<void*> RawData;
PropertyHandle->AccessRawData(RawData);
// Don't commit the Multiple Values text if there are multiple properties being set
if (RawData.Num() > 0 && (RawData.Num() == 1 || NewText.ToString() != MultipleValuesText.ToString()))
{
PropertyHandle->NotifyPreChange();
for (void* const RawDatum : RawData)
{
FText& PropertyValue = *(reinterpret_cast<FText* const>(RawDatum));
// FText::FromString on the result of FText::ToString is intentional. For now, we want to nuke any namespace/key info and let it get regenerated from scratch,
// rather than risk adopting whatever came through some chain of calls. This will be replaced when preserving of identity is implemented.
PropertyValue = FText::FromString(NewText.ToString());
}
PropertyHandle->NotifyPostChange();
PropertyHandle->NotifyFinishedChangingProperties();
}
};
TSharedPtr<SHorizontalBox> HorizontalBox;
bool bIsPassword = PropertyHandle->GetBoolMetaData("PasswordField");
bIsMultiLine = PropertyHandle->GetBoolMetaData("MultiLine");
if(bIsMultiLine)
{
ChildSlot
[
SAssignNew(HorizontalBox, SHorizontalBox)
+SHorizontalBox::Slot()
.FillWidth(1.0f)
[
SNew( SBox )
.MaxDesiredHeight(300.f)
[
SAssignNew(MultiLineWidget, SMultiLineEditableTextBox)
.Text_Lambda(GetTextValue)
.Font(InArgs._Font)
.SelectAllTextWhenFocused(false)
.ClearKeyboardFocusOnCommit(false)
.OnTextCommitted_Lambda(OnTextCommitted)
.SelectAllTextOnCommit(false)
.IsReadOnly(this, &STextPropertyWidget::IsReadOnly)
.AutoWrapText(true)
.ModiferKeyForNewLine(EModifierKey::Shift)
.IsPassword(bIsPassword)
]
]
];
PrimaryWidget = MultiLineWidget;
}
else
{
ChildSlot
[
SAssignNew(HorizontalBox, SHorizontalBox)
+SHorizontalBox::Slot()
.FillWidth(1.0f)
[
SAssignNew( SingleLineWidget, SEditableTextBox )
.Text_Lambda(GetTextValue)
.Font( InArgs._Font )
.SelectAllTextWhenFocused( true )
.ClearKeyboardFocusOnCommit(false)
//.........这里部分代码省略.........
示例6: PushUnknownByte
void FDataStructure::PushUnknownByte()
{
DataStructure.Top().PartSize++;
}