27#include "CoreMinimal.h"
56 Value.Emplace<NumberType>(0);
65 Value.Emplace<NumberType>(0);
76 Value.Set<NumberType>(InValue);
87 Value.Set<NumberType>(InValue);
98 Value.Set<NumberType>(InValue);
109 Value.Set<NumberType>(InValue);
120 Value.Set<NumberType>(InValue);
131 Value.Set<NumberType>(InValue);
142 Value.Set<TSharedPtr<ObjectType>>(MakeShared<ObjectType>(InValue));
153 Value.Emplace<TSharedPtr<ObjectType>>(MakeShared<ObjectType>(MoveTemp(InValue)));
164 Value.Set<ArrayType>(InValue);
175 Value.Emplace<ArrayType>(MoveTemp(InValue));
186 Value.Set<StringType>(InValue);
197 Value.Emplace<StringType>(MoveTemp(InValue));
208 Value.Set<BooleanType>(InValue);
219 Value.Set<BinaryType>(InValue);
230 Value.Emplace<BinaryType>(MoveTemp(InValue));
240 Type = OtherValue.Type;
241 Value = OtherValue.Value;
251 Type = MoveTemp(OtherValue.Type);
252 Value = MoveTemp(OtherValue.Value);
269 Type = OtherValue.Type;
270 Value = OtherValue.Value;
283 Type = MoveTemp(OtherValue.Type);
284 Value = MoveTemp(OtherValue.Value);
340 return Value.Get<NumberType>();
347 return Value.Get<NumberType>();
354 return Value.Get<NumberType>();
361 return Value.Get<NumberType>();
368 return Value.Get<NumberType>();
372 FORCEINLINE
const TMap<FString, FSignalRValue>&
AsObject()
const
375 return *Value.Get<TSharedPtr<ObjectType>>();
379 FORCEINLINE
const TArray<FSignalRValue>&
AsArray()
const
382 return Value.Get<ArrayType>();
389 return Value.Get<StringType>();
396 return Value.Get<BooleanType>();
403 return Value.Get<BinaryType>();
409 using NumberType = double;
410 using ObjectType = TMap<FString, FSignalRValue>;
411 using ArrayType = TArray<FSignalRValue>;
412 using StringType = FString;
413 using BooleanType = bool;
414 using BinaryType = TArray<uint8>;
415 using FInternalValueVariant = TVariant<NumberType, TSharedPtr<ObjectType>, ArrayType, StringType, BooleanType, BinaryType>;
417 FInternalValueVariant Value;
FORCEINLINE bool IsBinary() const
Definition SignalRValue.h:325
FORCEINLINE const TArray< uint8 > & AsBinary() const
Definition SignalRValue.h:400
FSignalRValue(const float InValue)
Create an object representing a EValueType::Number with the given float value.
Definition SignalRValue.h:117
EValueType
Enumeration of possible value types that can be stored in a FSignalRValue.
Definition SignalRValue.h:40
@ String
Definition SignalRValue.h:44
@ Boolean
Definition SignalRValue.h:46
@ Array
Definition SignalRValue.h:43
@ Object
Definition SignalRValue.h:42
@ Binary
Definition SignalRValue.h:47
@ Number
Definition SignalRValue.h:41
@ Null
Definition SignalRValue.h:45
FSignalRValue()
Create an object representing a EValueType::Null value.
Definition SignalRValue.h:53
FSignalRValue(const uint64 InValue)
Create an object representing a EValueType::Number with the given unsigned 64-bit integer value.
Definition SignalRValue.h:106
FSignalRValue(const TMap< FString, FSignalRValue > &InValue)
Create an object representing a EValueType::Object with the given map of string-values.
Definition SignalRValue.h:139
FSignalRValue(TArray< uint8 > &&InValue)
Create an object representing a EValueType::Binary with the given array of byte's.
Definition SignalRValue.h:227
FORCEINLINE bool IsArray() const
Definition SignalRValue.h:313
FSignalRValue(const FSignalRValue &OtherValue)
Copies an existing value.
Definition SignalRValue.h:238
FORCEINLINE const FString & AsString() const
Definition SignalRValue.h:386
FSignalRValue(TArray< FSignalRValue > &&InValue)
Create an object representing a EValueType::Array with the given array of values.
Definition SignalRValue.h:172
FSignalRValue(const TArray< FSignalRValue > &InValue)
Create an object representing a EValueType::Array with the given array of values.
Definition SignalRValue.h:161
FSignalRValue(TMap< FString, FSignalRValue > &&InValue)
Create an object representing a EValueType::Object with the given map of string-values.
Definition SignalRValue.h:150
~FSignalRValue()=default
Cleans up the resources associated with the value.
FORCEINLINE bool IsNumber() const
Definition SignalRValue.h:289
FSignalRValue(const TArray< uint8 > &InValue)
Create an object representing a EValueType::Binary with the given array of byte's.
Definition SignalRValue.h:216
FORCEINLINE int64 AsInt() const
Definition SignalRValue.h:337
FORCEINLINE bool AsBool() const
Definition SignalRValue.h:393
FSignalRValue & operator=(const FSignalRValue &OtherValue)
Copies an existing value.
Definition SignalRValue.h:267
FSignalRValue(const double InValue)
Create an object representing a EValueType::Number with the given double value.
Definition SignalRValue.h:128
FSignalRValue(const int32 InValue)
Create an object representing a EValueType::Number with the given integer value.
Definition SignalRValue.h:73
FORCEINLINE EValueType GetType() const
Definition SignalRValue.h:331
FORCEINLINE double AsNumber() const
Definition SignalRValue.h:365
FORCEINLINE bool IsObject() const
Definition SignalRValue.h:295
FSignalRValue(const FString &InValue)
Create an object representing a EValueType::String with the given string value.
Definition SignalRValue.h:183
FORCEINLINE const TArray< FSignalRValue > & AsArray() const
Definition SignalRValue.h:379
FORCEINLINE bool IsNull() const
Definition SignalRValue.h:307
FSignalRValue & operator=(FSignalRValue &&OtherValue) noexcept
Moves an existing value.
Definition SignalRValue.h:281
FORCEINLINE uint64 AsUInt() const
Definition SignalRValue.h:344
FORCEINLINE double AsDouble() const
Definition SignalRValue.h:358
FORCEINLINE const TMap< FString, FSignalRValue > & AsObject() const
Definition SignalRValue.h:372
FORCEINLINE bool IsBoolean() const
Definition SignalRValue.h:319
FSignalRValue(const int64 InValue)
Create an object representing a EValueType::Number with the given 64-bit integer value.
Definition SignalRValue.h:95
FORCEINLINE bool IsString() const
Definition SignalRValue.h:301
FSignalRValue(bool InValue)
Create an object representing a EValueType::Boolean with the given bool value.
Definition SignalRValue.h:205
FSignalRValue(FString &&InValue)
Create an object representing a EValueType::String with the given string value.
Definition SignalRValue.h:194
FORCEINLINE float AsFloat() const
Definition SignalRValue.h:351
FSignalRValue(FSignalRValue &&OtherValue) noexcept
Moves an existing value.
Definition SignalRValue.h:249
FSignalRValue(std::nullptr_t)
Create an object representing a EValueType::Null value.
Definition SignalRValue.h:62
FSignalRValue(const uint32 InValue)
Create an object representing a EValueType::Number with the given unsigned integer value.
Definition SignalRValue.h:84