5#include "Containers/Array.h"
6#include "Containers/Map.h"
55template<
typename... ValueTypes>
67 template<
typename ValueType,
typename VariantValueType = std::remove_cv_t<std::remove_reference_t<ValueType>>>
73 template<
typename ValueType>
82 template<
typename ValueType>
97 template<
typename ValueType>
112 template<
typename ValueType>
129template<
typename KeyType,
typename... ValueTypes>
141 template<
typename ValueType,
typename AddKeyType,
typename VariantValueType = std::remove_cv_t<std::remove_reference_t<ValueType>>>
147 template<
typename ValueType>
156 template<
typename ValueType,
typename GetKeyType>
171 template<
typename ValueType,
typename GetKeyType>
186 template<
typename ValueType>
198 return MapType::Num() ==
OutValue.Num();
220 template<
typename VisitType>
234 return VisitSet.Contains(ID);
239 return FString::Printf(
TEXT(
"%p"),
InID);
255 return VisitSet.Contains(ID) || VisitSet.Contains(
FDualType{ ID.Value, ID.Key });
265 template<
typename VisitType,
int32 MaxDepth>
305 return FString::Printf(
TEXT(
"Max Depth Reached: %d!"), MaxDepth);
309 return FString::Printf(
TEXT(
"Duplicate scope: %s!"), *ToString(
ID));
335 template<
int32 MaxDepth,
typename KeyType,
typename... ValueTypes,
typename T>
342 template<
int32 MaxDepth,
typename KeyType,
typename... ValueTypes>
346 template<
int32 MaxDepth,
typename KeyType,
typename... ValueTypes>
350 const ThisType&
LeftTyped =
static_cast<const ThisType&
>(Lhs);
351 const ThisType&
RightTyped =
static_cast<const ThisType&
>(Rhs);
385 template<
int32 MaxDepth,
typename KeyType,
typename... ValueTypes>
388 return Compare<MaxDepth, KeyType, ValueTypes...>(*Lhs, *Rhs, Visited);
392 template<
int32 MaxDepth,
typename KeyType,
typename... ValueTypes>
396 using MapType =
typename ThisType::MapType;
397 using VariantType =
typename ThisType::VariantType;
399 const MapType&
LeftTyped =
static_cast<const MapType&
>(Lhs);
400 const MapType&
RightTyped =
static_cast<const MapType&
>(Rhs);
442 template<
int32 MaxDepth,
typename KeyType,
typename... ValueTypes>
445 return Compare<MaxDepth, KeyType, ValueTypes...>(*Lhs, *Rhs, Visited);
448 template<
int32 MaxDepth,
typename KeyType,
typename... ValueTypes>
455 if constexpr (!std::is_same_v<LeftDecayed, RightDecayed>)
471 OutString.AppendChar(
TEXT(
'\t'));
495 OutString += FString::Printf(
TEXT(
"%.*f"), Precision,
Double);
503 using DecayedType = std::decay_t<
decltype(Visited)>;
509 OutString.AppendChar(
TEXT(
'\n'));
519 OutString.AppendChar(
TEXT(
'\n'));
524 else if constexpr (std::is_floating_point_v<DecayedType>)
532 AppendValue(OutString,
static_cast<double>(Visited), 2);
533 OutString.AppendChar(
TEXT(
'\n'));
544 OutString.AppendChar(
TEXT(
'\n'));
560 OutString.AppendChar(
TEXT(
'\n'));
565 OutString +=
TEXT(
"[\n");
573 for (
int32 i = 0; i < ArrayNum; ++i)
580 OutString +=
TEXT(
"]\n");
587 using MapType =
typename ThisType::MapType;
590 const MapType&
MapBase =
static_cast<const MapType&
>(
Map);
600 OutString.AppendChar(
TEXT(
'\n'));
605 OutString +=
TEXT(
"{\n");
614 OutString +=
TEXT(
": ");
620 OutString +=
TEXT(
"}\n");
626template<
typename KeyType,
typename... ValueTypes>
636 constexpr int32 MaxDepth = 64;
638 return UE::Online::NestedVariant::Compare<MaxDepth>(*
this,
Other, Visited);
643 return !(*
this ==
Other);
646 template<
int32 MaxDepth = 32,
int32 TabOffset = 0>
649 OutString.Reset(256);
652 UE::Online::NestedVariant::AppendArray<MaxDepth, TabOffset>(*
this, OutString, Visited);
655 OutString.RemoveFromEnd(
TEXT(
"\n"));
660template<
typename KeyType,
typename... ValueTypes>
661class TNestedVariantMap :
public TVariantMap<KeyType, ValueTypes..., TNestedVariantArrayRef<KeyType, ValueTypes...>, TNestedVariantMapRef<KeyType, ValueTypes...>>
670 constexpr int32 MaxDepth = 64;
672 return UE::Online::NestedVariant::Compare<MaxDepth>(*
this,
Other, Visited);
677 return !(*
this ==
Other);
680 template<
int32 MaxDepth = 32,
int32 TabOffset = 0>
683 OutString.Reset(256);
686 UE::Online::NestedVariant::AppendMap<MaxDepth, TabOffset>(*
this, OutString, Visited);
689 OutString.RemoveFromEnd(
TEXT(
"\n"));
694template<
typename KeyType,
typename... ValueTypes>
TSharedRef< InObjectType, InMode > MakeShared(InArgTypes &&... Args)
Definition SharedPointer.h:2009
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
const bool
Definition NetworkReplayStreaming.h:178
decltype(auto) Visit(Func &&Callable, Variants &&... Args)
Definition TVariant.h:271
constexpr TTuple< std::decay_t< Types >... > MakeTuple(Types &&... Args)
Definition Tuple.h:794
UE_REWRITE SizeType Num() const
Definition Array.h:1144
typename InAllocatorType::SizeType SizeType
Definition Array.h:675
UE_FORCEINLINE_HINT ElementType & Emplace_GetRef(ArgsType &&... Args) UE_LIFETIMEBOUND
Definition Array.h:2613
UE_NODEBUG UE_FORCEINLINE_HINT ElementType & operator[](SizeType Index) UE_LIFETIMEBOUND
Definition Array.h:1171
Definition UnrealString.h.inl:34
Definition NestedVariant.h:628
bool operator==(const TNestedVariantArray &Other) const
Definition NestedVariant.h:634
void ToDebugString(FString &OutString) const
Definition NestedVariant.h:647
bool operator!=(const TNestedVariantArray &Other) const
Definition NestedVariant.h:641
static TNestedVariantArrayRef< KeyType, ValueTypes... > CreateVariant()
Definition NestedVariant.h:630
Definition NestedVariant.h:662
bool operator==(const TNestedVariantMap &Other) const
Definition NestedVariant.h:668
void ToDebugString(FString &OutString) const
Definition NestedVariant.h:681
bool operator!=(const TNestedVariantMap &Other) const
Definition NestedVariant.h:675
static TNestedVariantMapRef< KeyType, ValueTypes... > CreateVariant()
Definition NestedVariant.h:664
Definition NestedVariant.h:696
Definition SharedPointer.h:1640
Definition SharedPointer.h:692
Definition SharedPointer.h:153
Definition NestedVariant.h:57
bool GetVariant(ArrayType::SizeType Index, ValueType &OutValue) const
Definition NestedVariant.h:98
static TSharedRef< TVariantArray< ValueTypes... > > CreateVariant()
Definition NestedVariant.h:62
VariantValueType & AddVariant(ValueType &&Value)
Definition NestedVariant.h:68
TVariant< ValueTypes... > VariantType
Definition NestedVariant.h:59
void AddVariantArray(const TArray< ValueType > &Array)
Definition NestedVariant.h:74
bool GetVariant(ArrayType::SizeType Index, TSharedPtr< ValueType > &OutValue) const
Definition NestedVariant.h:83
bool GetVariantArray(TArray< ValueType > &OutValue) const
Definition NestedVariant.h:113
Definition NestedVariant.h:131
TVariant< ValueTypes... > VariantType
Definition NestedVariant.h:133
static TSharedRef< TVariantMap< KeyType, ValueTypes... > > CreateVariant()
Definition NestedVariant.h:136
bool GetVariant(const GetKeyType &Key, TSharedPtr< ValueType > &OutValue) const
Definition NestedVariant.h:157
bool GetVariantMap(TMap< KeyType, ValueType > &OutValue) const
Definition NestedVariant.h:187
void AddVariantMap(const TMap< KeyType, ValueType > &Map)
Definition NestedVariant.h:148
VariantValueType & AddVariant(AddKeyType &&Key, ValueType &&Value)
Definition NestedVariant.h:142
bool GetVariant(const GetKeyType &Key, ValueType &OutValue) const
Definition NestedVariant.h:172
uint32 MaxDepth
Definition AndroidPlatformStackWalk.cpp:159
Definition NestedVariant.h:219
bool Compare(const T &Lhs, const T &Rhs, FDualVisit &)
Definition NestedVariant.h:336
void AppendMap(const TNestedVariantMap< KeyType, ValueTypes... > &Map, FString &OutString, FSingleVisit &Visited)
Definition NestedVariant.h:584
const void * FSingleType
Definition NestedVariant.h:224
TSet< VisitType > TGuardType
Definition NestedVariant.h:221
TGuardType< FDualType > FDualVisit
Definition NestedVariant.h:245
bool ContainsID(const FSingleVisit &VisitSet, FSingleType ID)
Definition NestedVariant.h:232
bool CompareVariants(const FNestedVariantValue< KeyType, ValueTypes... > &Lhs, const FNestedVariantValue< KeyType, ValueTypes... > &Rhs, FDualVisit &VisitedSet)
Definition NestedVariant.h:449
FSingleType MakeID(const void *InID)
Definition NestedVariant.h:227
void AppendArray(const TNestedVariantArray< KeyType, ValueTypes... > &Array, FString &OutString, FSingleVisit &Visited)
Definition NestedVariant.h:550
void AppendVariant(const FNestedVariantValue< KeyType, ValueTypes... > &Variant, FString &OutString, FSingleVisit &VisitedSet)
Definition NestedVariant.h:499
void AppendIndent(FString &OutString, int32 TabDepth)
Definition NestedVariant.h:467
void AppendValue(FString &OutString, const T &V)
Definition NestedVariant.h:483
TGuardType< FSingleType > FSingleVisit
Definition NestedVariant.h:225
const TCHAR * LexToString(EOnlineServices Value)
Definition CoreOnline.cpp:28
U16 Index
Definition radfft.cpp:71
Definition NestedVariant.h:267
TGuardType< VisitType > & Visited
Definition NestedVariant.h:268
TRecursionScope(TGuardType< VisitType > &InVisited, const void *InID)
Definition NestedVariant.h:274
FString GetError() const
Definition NestedVariant.h:295
TRecursionScope(TGuardType< VisitType > &InVisited, const void *InLeft, const void *InRight)
Definition NestedVariant.h:279
~TRecursionScope()
Definition NestedVariant.h:284
bool bSuccess
Definition NestedVariant.h:270
VisitType ID
Definition NestedVariant.h:269