// Copyright Epic Games, Inc. All Rights Reserved. #pragma once namespace UE { template bool FJsonConfig::TryGetNumber(const FJsonPath& Path, T& OutValue) const { TSharedPtr JsonValue; if (!TryGetJsonValue(Path, JsonValue)) { return false; } return JsonValue->TryGetNumber(OutValue); } template bool FJsonConfig::TryGetArrayHelper(const FJsonPath& Path, TArray& OutArray, TGetter Getter) const { if (!IsValid()) { return false; } TArray> JsonValueArray; if (!TryGetArray(Path, JsonValueArray)) { return false; } OutArray.Reset(); for (const TSharedPtr& JsonValue : JsonValueArray) { T Value; if (!Getter(JsonValue, Value)) { OutArray.Reset(); return false; } OutArray.Add(Value); } return true; } template bool FJsonConfig::TryGetNumericArrayHelper(const FJsonPath& Path, TArray& OutArray) const { return TryGetArrayHelper(Path, OutArray, [](const TSharedPtr& JsonValue, T& OutNumber) { return JsonValue->TryGetNumber(OutNumber); }); } template bool FJsonConfig::SetNumber(const FJsonPath& Path, T Value) { static_assert(TIsArithmetic::Value, "Value type must be a number."); TSharedPtr JsonValue = MakeShared((double) Value); return SetJsonValue(Path, JsonValue); } }