当前位置: 首页>>代码示例>>C++>>正文


C++ TSharedPtr::Add方法代码示例

本文整理汇总了C++中TSharedPtr::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ TSharedPtr::Add方法的具体用法?C++ TSharedPtr::Add怎么用?C++ TSharedPtr::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TSharedPtr的用法示例。


在下文中一共展示了TSharedPtr::Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MakeActorPickerWithMenu

TSharedRef<SWidget> SPropertyEditorAsset::OnGetMenuContent()
{
	FObjectOrAssetData Value;
	GetValue(Value);

	if(bIsActor)
	{
		TSharedPtr<SceneOutliner::FOutlinerFilters> ActorFilters = MakeShareable( new SceneOutliner::FOutlinerFilters );
		ActorFilters->Add( MakeShareable( new TDelegateFilter< const AActor* const >( TDelegateFilter< const AActor* const >::FPredicate::CreateSP( this, &SPropertyEditorAsset::IsFilteredActor ) ) ) );

		return PropertyCustomizationHelpers::MakeActorPickerWithMenu(Cast<AActor>(Value.Object),
																	 bAllowClear,
																	 ActorFilters,
																	 FOnActorSelected::CreateSP( this, &SPropertyEditorAsset::OnActorSelected),
																	 FSimpleDelegate::CreateSP( this, &SPropertyEditorAsset::CloseComboButton ),
																	 FSimpleDelegate::CreateSP( this, &SPropertyEditorAsset::OnUse ) );
	}
	else
	{
		TArray<const UClass*> AllowedClasses;
		AllowedClasses.Add(ObjectClass);

		return PropertyCustomizationHelpers::MakeAssetPickerWithMenu(Value.AssetData,
																	 bAllowClear,
																	 AllowedClasses,
																	 OnShouldFilterAsset,
																	 FOnAssetSelected::CreateSP(this, &SPropertyEditorAsset::OnAssetSelected),
																	 FSimpleDelegate::CreateSP(this, &SPropertyEditorAsset::CloseComboButton));
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:30,代码来源:SPropertyEditorAsset.cpp

示例2: AddConflict

void FConflictReportInfo::AddConflict(const FString& Namespace, const FString& Key, const TSharedPtr<FLocMetadataObject> KeyMetadata, const FLocItem& Source, const FString& SourceLocation )
{
	TSharedPtr< FLocConflict > ExistingEntry = FindEntryByKey( Namespace, Key, KeyMetadata );
	if( !ExistingEntry.IsValid() )
	{
		TSharedRef< FLocConflict > NewEntry = MakeShareable( new FLocConflict( Namespace, Key, KeyMetadata ) );
		EntriesByKey.Add( Key, NewEntry );
		ExistingEntry = NewEntry;
	}
	ExistingEntry->Add( Source, SourceLocation.ReplaceCharWithEscapedChar() );
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:11,代码来源:GatherTextCommandletBase.cpp

示例3: OnGetActorFiltersForSceneOutliner

void FPropertyEditor::OnGetActorFiltersForSceneOutliner( TSharedPtr<SceneOutliner::FOutlinerFilters>& OutFilters )
{
	struct Local
	{
		static bool IsFilteredActor( const AActor* const Actor, TSharedRef<FPropertyEditor> PropertyEditor )
		{
			const TSharedRef<FPropertyNode> PropertyNode = PropertyEditor->GetPropertyNode();
			UProperty* NodeProperty = PropertyNode->GetProperty();

			UObjectPropertyBase* ObjProp = Cast<UObjectPropertyBase>( NodeProperty );

			// This class and its children are the classes that we can show objects for
			UClass* AllowedClass = ObjProp ? ObjProp->PropertyClass : AActor::StaticClass();

			return Actor->IsA( AllowedClass );
		}
	};

	OutFilters->Add( MakeShareable( new TDelegateFilter< const AActor* const >( TDelegateFilter< const AActor* const >::FPredicate::CreateStatic( &Local::IsFilteredActor, AsShared() ) ) ) );
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:20,代码来源:PropertyEditor.cpp

示例4: MakeShareable

TSharedPtr<TArray<FString> > FP4DataProxy::GetPossibleGameNames()
{
	TSharedPtr<TArray<FString> > PossibleGames = MakeShareable(new TArray<FString>());

	FP4Env& Env = FP4Env::Get();

	FString FileList;
	if (!Env.RunP4Output(FString::Printf(TEXT("files -e %s/.../Build/ArtistSyncRules.xml"), *Env.GetBranch()), FileList) || FileList.IsEmpty())
	{
		return PossibleGames;
	}

	FString Line, Rest = FileList;
	while (Rest.Split(LINE_TERMINATOR, &Line, &Rest, ESearchCase::CaseSensitive))
	{
		if (!Line.StartsWith(Env.GetBranch()))
		{
			continue;
		}

		int32 ArtistSyncRulesPos = Line.Find("/Build/ArtistSyncRules.xml#", ESearchCase::IgnoreCase);

		if (ArtistSyncRulesPos == INDEX_NONE)
		{
			continue;
		}

		FString MiddlePart = Line.Mid(Env.GetBranch().Len(), ArtistSyncRulesPos - Env.GetBranch().Len());

		int32 LastSlash = INDEX_NONE;
		MiddlePart.FindLastChar('/', LastSlash);

		PossibleGames->Add(MiddlePart.Mid(LastSlash + 1));
	}

	return PossibleGames;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:37,代码来源:P4DataCache.cpp

示例5: MeasureStringInternal

FVector2D FSlateFontMeasure::MeasureStringInternal( const FString& Text, int32 StartIndex, int32 EndIndex, const FSlateFontInfo& InFontInfo, bool IncludeKerningWithPrecedingChar, float FontScale, int32 StopAfterHorizontalOffset, ELastCharacterIndexFormat CharIndexFormat, int32& OutLastCharacterIndex ) const
{
	SCOPE_CYCLE_COUNTER(STAT_SlateMeasureStringTime);
	FCharacterList& CharacterList = FontCache->GetCharacterList( InFontInfo, FontScale );
	const uint16 MaxHeight = CharacterList.GetMaxHeight();

	const bool DoesStartAtBeginning = StartIndex == 0;
	const bool DoesFinishAtEnd = EndIndex == Text.Len();
	const int32 TextRangeLength = EndIndex - StartIndex;
	if ( EndIndex - StartIndex <= 0 || EndIndex <= 0 || StartIndex < 0 || EndIndex <= StartIndex )
	{
		return FVector2D( 0, MaxHeight );
	}

#define USE_MEASURE_CACHING 1
#if USE_MEASURE_CACHING
	TSharedPtr< FMeasureCache > CurrentMeasureCache = NULL;
	// Do not cache strings which have small sizes or which have complicated measure requirements
	if( DoesStartAtBeginning && DoesFinishAtEnd && !IncludeKerningWithPrecedingChar && TextRangeLength > 5 && StopAfterHorizontalOffset == INDEX_NONE )
	{
		FSlateFontKey FontKey(InFontInfo,FontScale);
		TSharedPtr< FMeasureCache > FoundMeasureCache = FontToMeasureCache.FindRef( FontKey );

		if ( FoundMeasureCache.IsValid() )
		{
			CurrentMeasureCache = FoundMeasureCache;
			const FVector2D* CachedMeasurement = CurrentMeasureCache->AccessItem( Text );
			if( CachedMeasurement )
			{
				return *CachedMeasurement;
			}
		}
		else
		{
			CurrentMeasureCache = MakeShareable( new FMeasureCache( FontMeasureConstants::MeasureCacheSize ) );
			FontToMeasureCache.Add( FontKey, CurrentMeasureCache );
		}
	}
#endif

	// The size of the string
	FVector2D Size(0,0);
	// Widest line encountered while drawing this text.
	int32 MaxLineWidth = 0;
	// The width of the current line so far.
	int32 CurrentX = 0;
	// Accumulated height of this block of text
	int32 StringSizeY = MaxHeight;
	// The previous char (for kerning)
	TCHAR PreviousChar = 0;

	//If we are measuring a range then we should take into account the kerning with the character before the start of the range
	if ( !DoesStartAtBeginning && IncludeKerningWithPrecedingChar )
	{
		PreviousChar = Text[ StartIndex - 1 ];
	}

	int32 FinalPosX = 0;

	int32 CharIndex;
	for( CharIndex = StartIndex; CharIndex < EndIndex; ++CharIndex )
	{
		TCHAR CurrentChar = Text[CharIndex];

		const bool IsNewline = (CurrentChar == '\n');

		if (IsNewline)
		{
			// New line means
			// 1) we accumulate total height
			StringSizeY += MaxHeight;
			// 2) update the longest line we've encountered
			MaxLineWidth = FMath::Max(CurrentX, MaxLineWidth);
			// 3) the next line starts at the beginning
			CurrentX = 0;
		}
		else
		{
			const FCharacterEntry& Entry = CharacterList[CurrentChar];

			int32 Kerning = 0;
			if( CharIndex > 0 )
			{
				Kerning = CharacterList.GetKerning( PreviousChar, CurrentChar );
			}

			const int32 TotalCharSpacing = 
				Kerning + Entry.HorizontalOffset +		// Width is any kerning plus how much to advance the position when drawing a new character
				Entry.XAdvance;	// How far we advance 

			PreviousChar = CurrentChar;

			CurrentX += Kerning + Entry.XAdvance;

			// Were we asked to stop measuring after the specified horizontal offset in pixels?
			if( StopAfterHorizontalOffset != INDEX_NONE )
			{
				if( CharIndexFormat == ELastCharacterIndexFormat::CharacterAtOffset )
				{
					// Round our test toward the character's center position
//.........这里部分代码省略.........
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:101,代码来源:FontMeasure.cpp


注:本文中的TSharedPtr::Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。