Files
UnrealEngineUWP/Engine/Source/Runtime/JsonUtilities/Public/JsonObjectWrapper.h
george rolfe e92e7071dd JsonObjectWrapper initialization without loading from string
#jira none

#preflight 61f9bda51d7ca8ed2d5e7998

#rb none

#ROBOMERGE-AUTHOR: george.rolfe
#ROBOMERGE-SOURCE: CL 18818435 in //UE5/Release-5.0/... via CL 18818457 via CL 18822877
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18824727 by george rolfe in ue5-main branch]
2022-02-02 07:59:56 -05:00

53 lines
1.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "UObject/Object.h"
#include "UObject/Class.h"
#include "JsonObjectWrapper.generated.h"
class FJsonObject;
/** UStruct that holds a JsonObject, can be used by structs passed to JsonObjectConverter to pass through JsonObjects directly */
USTRUCT(BlueprintType, meta = (DisplayName = "JsonObject"))
struct JSONUTILITIES_API FJsonObjectWrapper
{
GENERATED_USTRUCT_BODY()
public:
FJsonObjectWrapper();
UPROPERTY(EditAnywhere, Category = "JSON")
FString JsonString;
TSharedPtr<FJsonObject> JsonObject;
bool ImportTextItem(const TCHAR*& Buffer, int32 PortFlags, UObject* Parent, FOutputDevice* ErrorText);
bool ExportTextItem(FString& ValueStr, FJsonObjectWrapper const& DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope) const;
void PostSerialize(const FArchive& Ar);
explicit operator bool() const;
bool JsonObjectToString(FString& Str) const;
bool JsonObjectFromString(const FString& Str);
};
template<>
struct TStructOpsTypeTraits<FJsonObjectWrapper> : public TStructOpsTypeTraitsBase2<FJsonObjectWrapper>
{
enum
{
WithImportTextItem = true,
WithExportTextItem = true,
WithPostSerialize = true,
};
};
UCLASS()
class UJsonUtilitiesDummyObject : public UObject
{
GENERATED_BODY()
};