UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SlateAttributeContained.inl
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include <type_traits>
6
7
8class SWidget;
9
10
13{
17 template<typename InObjectType, typename InInvalidationReasonPredicate, typename InComparePredicate>
18 struct TSlateContainedAttribute : public TSlateAttributeBase<ISlateAttributeContainer, InObjectType, InInvalidationReasonPredicate, InComparePredicate, ESlateAttributeType::Contained>
19 {
20 private:
22
24 static void VerifyAttributeAddress(const ContainerType& Container, const TSlateContainedAttribute& Self)
25 {
26 checkf((UPTRINT)&Self >= (UPTRINT)&Container && (UPTRINT)&Self < (UPTRINT)&Container + sizeof(ContainerType),
27 TEXT("Use TAttribute or TSlateManagedAttribute instead. See SlateAttribute.h for more info."));
28 static_assert(!Super::HasDefinedInvalidationReason, "Define the Invalidation Reason in SlateAttributeDescriptor.");
29 }
30
31 public:
32 using FGetter = typename Super::FGetter;
33 using ObjectType = typename Super::ObjectType;
34
35 public:
36 //~ You can only register Attribute that are defined in a ISlateAttributeContainerOwner.
37 //~ Use the constructor with a ISlateAttributeContainerOwner pointer.
38 //~ See documentation in SlateAttribute.h for more info.
44
46 explicit TSlateContainedAttribute(ContainerType& Container)
47 {
48 VerifyAttributeAddress(Container, *this);
49 }
50
52 explicit TSlateContainedAttribute(ContainerType& Container, const ObjectType& InValue)
53 : Super(InValue)
54 {
55 VerifyAttributeAddress(Container, *this);
56 }
57
61 {
62 VerifyAttributeAddress(Container, *this);
63 }
64 };
65} // SlateAttributePrivate
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
return Self
Definition CocoaThread.cpp:337
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::UPTRINT UPTRINT
An unsigned integer the same size as a pointer.
Definition Platform.h:1146
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
Definition SWidget.h:165
Definition SlateAttribute.cpp:11
Definition SlateAttributeBase.inl:20
Definition SlateAttributeContained.inl:19
TSlateContainedAttribute(ContainerType &Container)
Definition SlateAttributeContained.inl:46
TSlateContainedAttribute(const TSlateContainedAttribute &)=delete
typename Super::FGetter FGetter
Definition SlateAttributeContained.inl:32
TSlateContainedAttribute(ContainerType &Container, ObjectType &&InValue)
Definition SlateAttributeContained.inl:59
typename Super::ObjectType ObjectType
Definition SlateAttributeContained.inl:33
TSlateContainedAttribute & operator=(TSlateContainedAttribute &&)=delete
TSlateContainedAttribute(ContainerType &Container, const ObjectType &InValue)
Definition SlateAttributeContained.inl:52
TSlateContainedAttribute(TSlateContainedAttribute &&)=delete
TSlateContainedAttribute & operator=(const TSlateContainedAttribute &)=delete