You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Change WebRemoteControlInternalUtils.cpp to use WIDECHAR [FYI] aurel.cordonnier Original CL Desc ----------------------------------------------------------------- [Backout] - CL22811007 [FYI] Justin.Marcus Original CL Desc ----------------------------------------------------------------- Fix JSON Reader UTF8 parsing. Add ability to use JSON Reader with a string view. Add explicit UTF8 smoke tests. Change uses of TJsonReader<UCS2CHAR> to TJsonReader<WIDECHAR> since TStringBuilder<UCS2CHAR> doesn't compile. Change uses of TJsonReader<char> to TJsonReader<UTF8CHAR>. There isn't much use for TJsonReader<char> as ASCII is a subset of UTF8 so TJsonReader<UTF8CHAR> is always preferable. #rb [at]Steve.Robb #preflight https://horde.devtools.epicgames.com/job/635980ead86d91ca2cfabc77 [CL 22835909 by justin marcus in ue5-main branch]
77 lines
2.0 KiB
C++
77 lines
2.0 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "Containers/UnrealString.h"
|
|
#include "CoreMinimal.h"
|
|
#include "HAL/Platform.h"
|
|
#include "IStructDeserializerBackend.h"
|
|
#include "Serialization/JsonReader.h"
|
|
#include "Serialization/JsonTypes.h"
|
|
#include "Templates/SharedPointer.h"
|
|
|
|
class FArchive;
|
|
class FProperty;
|
|
|
|
/**
|
|
* Implements a reader for UStruct deserialization using Json.
|
|
*
|
|
* Note: The underlying Json de-serializer is currently hard-coded to use UCS2CHAR.
|
|
* This is because the current JsonReader API does not allow writers to be substituted since it's
|
|
* all based on templates. At some point we will refactor the low-level Json API to provide more
|
|
* flexibility for serialization.
|
|
*/
|
|
class SERIALIZATION_API FJsonStructDeserializerBackend
|
|
: public IStructDeserializerBackend
|
|
{
|
|
public:
|
|
|
|
/**
|
|
* Creates and initializes a new instance.
|
|
*
|
|
* @param Archive The archive to deserialize from.
|
|
*/
|
|
FJsonStructDeserializerBackend( FArchive& Archive )
|
|
: JsonReader(TJsonReader<WIDECHAR>::Create(&Archive))
|
|
{ }
|
|
|
|
public:
|
|
|
|
// IStructDeserializerBackend interface
|
|
|
|
virtual const FString& GetCurrentPropertyName() const override;
|
|
virtual FString GetDebugString() const override;
|
|
virtual const FString& GetLastErrorMessage() const override;
|
|
virtual bool GetNextToken( EStructDeserializerBackendTokens& OutToken ) override;
|
|
virtual bool ReadProperty( FProperty* Property, FProperty* Outer, void* Data, int32 ArrayIndex ) override;
|
|
virtual void SkipArray() override;
|
|
virtual void SkipStructure() override;
|
|
|
|
protected:
|
|
FString& GetLastIdentifier()
|
|
{
|
|
return LastIdentifier;
|
|
}
|
|
|
|
EJsonNotation GetLastNotation()
|
|
{
|
|
return LastNotation;
|
|
}
|
|
|
|
TSharedRef<TJsonReader<WIDECHAR>>& GetReader()
|
|
{
|
|
return JsonReader;
|
|
}
|
|
|
|
private:
|
|
|
|
/** Holds the name of the last read Json identifier. */
|
|
FString LastIdentifier;
|
|
|
|
/** Holds the last read Json notation. */
|
|
EJsonNotation LastNotation;
|
|
|
|
/** Holds the Json reader used for the actual reading of the archive. */
|
|
TSharedRef<TJsonReader<WIDECHAR>> JsonReader;
|
|
};
|