UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VVMAbstractVisitorInline.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#if WITH_VERSE_VM || defined(__INTELLISENSE__)
6
10
11class UObject;
12
13namespace Verse
14{
15
16inline FAbstractVisitor::FReferrerContext::FReferrerContext(FAbstractVisitor& InVisitor, FReferenceToken InReferrer)
19{
20 Previous = Visitor.Context;
21 Visitor.Context = this;
22}
23
24inline FAbstractVisitor::FReferrerContext::~FReferrerContext()
25{
26 Visitor.Context = Previous;
27}
28
29template <typename T>
30inline void FAbstractVisitor::Visit(T& Value, const TCHAR* ElementName)
31{
32 using Verse::Visit;
33 Visit(*this, Value);
34}
35
36// Simple arrays
37template <typename T>
38inline void FAbstractVisitor::Visit(T Begin, T End, const TCHAR* ElementName)
39{
40 for (; Begin != End; ++Begin)
41 {
42 auto&& Element = *Begin;
43 Visit(Element, TEXT(""));
44 }
45}
46
47// Arrays
48template <typename ElementType, typename AllocatorType>
49inline void FAbstractVisitor::Visit(TArray<ElementType, AllocatorType>& Values, const TCHAR* ElementName)
50{
51 Visit(Values.begin(), Values.end(), ElementName);
52}
53
54// Sets
55template <typename ElementType, typename KeyFuncs, typename Allocator>
56inline void FAbstractVisitor::Visit(TSet<ElementType, KeyFuncs, Allocator>& Values, const TCHAR* ElementName)
57{
58 for (ElementType& Value : Values)
59 {
60 Visit(Value, TEXT(""));
61 }
62}
63
64// Maps
65template <typename KeyType, typename ValueType, typename SetAllocator, typename KeyFuncs>
66inline void FAbstractVisitor::Visit(TMap<KeyType, ValueType, SetAllocator, KeyFuncs>& Values, const TCHAR* ElementName)
67{
68 for (TPair<KeyType, ValueType>& Pair : Values)
69 {
70 Visit(Pair.Key, TEXT("Key"));
71 Visit(Pair.Value, TEXT("Value"));
72 }
73}
74
75} // namespace Verse
76#endif // WITH_VERSE_VM
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
decltype(auto) Visit(Func &&Callable, Variants &&... Args)
Definition TVariant.h:271
Definition Array.h:670
UE_NODEBUG UE_FORCEINLINE_HINT RangedForIteratorType end()
Definition Array.h:3391
UE_NODEBUG UE_FORCEINLINE_HINT RangedForIteratorType begin()
Definition Array.h:3389
Definition UnrealString.h.inl:34
Definition Object.h:95
@ Visitor
Definition XmppMultiUserChat.h:94
@ Element
Definition Visu.h:18
Definition Archive.h:36
Definition ReferenceToken.h:44
Definition Tuple.h:652