UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VVMEqualInline.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
9#include "VerseVM/VVMArray.h"
10#include "VerseVM/VVMFloat.h"
11#include "VerseVM/VVMInt.h"
12#include "VerseVM/VVMMap.h"
13#include "VerseVM/VVMOption.h"
14#include "VerseVM/VVMValue.h"
15
16namespace Verse
17{
18inline bool IsEmptyContainer(VValue Value)
19{
20 if (VArrayBase* Array = Value.DynamicCast<VArrayBase>())
21 {
22 return Array->Num() == 0;
23 }
24 if (VMapBase* Map = Value.DynamicCast<VMapBase>())
25 {
26 return Map->Num() == 0;
27 }
28 return false;
29}
30
31template <typename HandlePlaceholderFunction>
32inline ECompares VValue::Equal(FAllocationContext Context, VValue Left, VValue Right, HandlePlaceholderFunction HandlePlaceholder)
33{
34 AutoRTFM::UnreachableIfClosed("#jira SOL-8415");
35
36 if (Left.IsPlaceholder() || Right.IsPlaceholder())
37 {
39 return ECompares::Eq;
40 }
41 if (Left == Right)
42 {
43 return ECompares::Eq;
44 }
45 if (Left.IsFloat() && Right.IsFloat())
46 {
47 return Left.AsFloat() == Right.AsFloat() ? ECompares::Eq : ECompares::Neq;
48 }
49 if (Left.IsInt())
50 {
51 return VInt::Eq(Context, Left.AsInt(), Right) ? ECompares::Eq : ECompares::Neq;
52 }
53 if (Right.IsInt())
54 {
55 return VInt::Eq(Context, Right.AsInt(), Left) ? ECompares::Eq : ECompares::Neq;
56 }
58 {
59 return (Right.IsLogic() && !Right.AsBool()) || IsEmptyContainer(Right) ? ECompares::Eq : ECompares::Neq;
60 }
62 {
63 return (Left.IsLogic() && !Left.AsBool()) || IsEmptyContainer(Left) ? ECompares::Eq : ECompares::Neq;
64 }
65 if (Left.IsLogic() || Right.IsLogic())
66 {
67 return (Left.IsLogic() && Right.IsLogic() && Left.AsBool() == Right.AsBool()) ? ECompares::Eq : ECompares::Neq;
68 }
69 if (Left.IsEnumerator() || Right.IsEnumerator())
70 {
72 return ECompares::Neq;
73 }
74 if (Left.IsCell() && Right.IsCell())
75 {
76 VCell* LeftCell = &Left.AsCell();
77 VCell* RightCell = &Right.AsCell();
78
79 if (LeftCell->IsA<VOption>())
80 {
81 if (!RightCell->IsA<VOption>())
82 {
83 return ECompares::Neq;
84 }
85 return Equal(Context, LeftCell->StaticCast<VOption>().GetValue(), RightCell->StaticCast<VOption>().GetValue(), HandlePlaceholder);
86 }
88 }
89
90 return ECompares::Neq;
91}
92
93} // namespace Verse
94#endif // WITH_VERSE_VM
#define checkSlow(expr)
Definition AssertionMacros.h:332
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition Archive.h:36