Files
UnrealEngineUWP/Engine/Source/Programs/Shared/EpicGames.Core/JsonExtensions.cs
Ben Marsh 7e6b218492 Missing file.
[CL 18088774 by Ben Marsh in ue5-main branch]
2021-11-08 12:24:20 -05:00

46 lines
1.2 KiB
C#

// Copyright Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json;
namespace EpicGames.Core
{
/// <summary>
/// Utility methods for utf8 json reader/writer
/// </summary>
public static class JsonExtensions
{
/// <summary>
/// Tries to read a property name then move to the value token
/// </summary>
/// <param name="Reader">Token reader</param>
/// <param name="PropertyName">Receives the property name on success</param>
/// <returns>True if the read succeeded</returns>
public static bool TryReadNextPropertyName(ref Utf8JsonReader Reader, out ReadOnlySpan<byte> PropertyName)
{
if (Reader.Read() && Reader.TokenType == JsonTokenType.PropertyName)
{
PropertyName = Reader.ValueSpan;
return Reader.Read();
}
else
{
PropertyName = ReadOnlySpan<byte>.Empty;
return false;
}
}
/// <summary>
/// Reads a Utf8 string from the current json token
/// </summary>
/// <param name="Reader"></param>
/// <returns></returns>
public static Utf8String GetUtf8String(this Utf8JsonReader Reader)
{
throw new NotImplementedException();
}
}
}