UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
JsonStringifyStructuredArchive.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
8
9#if WITH_TEXT_ARCHIVE_SUPPORT
10
11namespace UE::Private
12{
13
14struct FJsonStringifyImpl;
15
16/*
17 FJsonStringifyStructuredArchive is an implementation detail of JsonObjectGraph. It provides support
18 for saving the relatively rare data that provides a native Serialize(FStructuredArchive::FRecord)
19 but explicitly disables serialization of reflected properties and versioning data, which are handled
20 by the root implementation
21*/
23{
25 const UObject* InObject,
26 int32 InitialIndentLevel,
27 FJsonStringifyImpl* InRootImpl,
30
31 // FMemoryWriter wants a byte array, so that's what we're working with at this level:
33
34 // Unsure if we want to use the structured archive for FText or the string encoding
35 // long term, this provides us the option:
36 static void WriteTextValueInline(FText Value, int32 IndentLevel, FArchive& ToWriter);
37 // FCustomVersion is best encoded via operator<<(FStructuredArchive::FSlot Slot, FCustomVersion& Version):
38 static void WriteCustomVersionValueInline(const TArray<FCustomVersion>& Version, int32 IndentLevel, FArchive& ToWriter);
39private:
41
42 virtual FArchive& GetUnderlyingArchive() override;
43
44 virtual bool HasDocumentTree() const override;
45
46 virtual void EnterRecord() override;
47 virtual void LeaveRecord() override;
48 virtual void EnterField(FArchiveFieldName Name) override;
49 virtual void LeaveField() override;
50 virtual bool TryEnterField(FArchiveFieldName Name, bool bEnterWhenSaving) override;
51
52 virtual void EnterArray(int32& NumElements) override;
53 virtual void LeaveArray() override;
54 virtual void EnterArrayElement() override;
55 virtual void LeaveArrayElement() override;
56
57 virtual void EnterStream() override;
58 virtual void LeaveStream() override;
59 virtual void EnterStreamElement() override;
60 virtual void LeaveStreamElement() override;
61
62 virtual void EnterMap(int32& NumElements) override;
63 virtual void LeaveMap() override;
64 virtual void EnterMapElement(FString& Name) override;
65 virtual void LeaveMapElement() override;
66
67 virtual void EnterAttributedValue() override;
68 virtual void EnterAttribute(FArchiveFieldName AttributeName) override;
69 virtual void EnterAttributedValueValue() override;
70 virtual void LeaveAttribute() override;
71 virtual void LeaveAttributedValue() override;
72 virtual bool TryEnterAttribute(FArchiveFieldName AttributeName, bool bEnterWhenSaving) override;
73
74 virtual bool TryEnterAttributedValueValue() override;
75
76 virtual void Serialize(uint8& Value) override;
77 virtual void Serialize(uint16& Value) override;
78 virtual void Serialize(uint32& Value) override;
79 virtual void Serialize(uint64& Value) override;
80 virtual void Serialize(int8& Value) override;
81 virtual void Serialize(int16& Value) override;
82 virtual void Serialize(int32& Value) override;
83 virtual void Serialize(int64& Value) override;
84 virtual void Serialize(float& Value) override;
85 virtual void Serialize(double& Value) override;
86 virtual void Serialize(bool& Value) override;
87 virtual void Serialize(UTF32CHAR& Value) override;
88 virtual void Serialize(FString& Value) override;
89 virtual void Serialize(FName& Value) override;
90 virtual void Serialize(UObject*& Value) override;
91#if WITH_VERSE_VM || defined(__INTELLISENSE__)
92 virtual void Serialize(Verse::VCell*& Value) override;
93#endif
94 virtual void Serialize(FText& Value) override;
95 virtual void Serialize(FWeakObjectPtr& Value) override;
96 virtual void Serialize(FSoftObjectPtr& Value) override;
97 virtual void Serialize(FSoftObjectPath& Value) override;
98 virtual void Serialize(FLazyObjectPtr& Value) override;
99 virtual void Serialize(FObjectPtr& Value) override;
100 virtual void Serialize(TArray<uint8>& Value) override;
101 virtual void Serialize(void* Data, uint64 DataSize) override;
102
104
105 void Write(const ANSICHAR* Text);
106 void Write(const FString& Text);
107
108 void WriteFieldName(const TCHAR* Name);
109 void WriteValue(const FString& Value);
110
111 void WriteOptionalComma();
116
117 void SerializeStringInternal(const FString& String);
118
119 TArray<FCustomVersion>* VersionsToHarvest;
121
124
125 const UObject* const Object;
126 FJsonStringifyImpl* RootImpl;
127
130 FArchive* Override = nullptr;
131
133 int32_t IndentLevel = 0;
134 bool bNeedsComma = false;
135 bool bNeedsNewline = false;
136};
137
138}
139
140#endif
FPlatformTypes::int16 int16
A 16-bit signed integer.
Definition Platform.h:1123
FPlatformTypes::int8 int8
An 8-bit signed integer.
Definition Platform.h:1121
FPlatformTypes::UTF32CHAR UTF32CHAR
A 32-bit character containing a UTF32 (Unicode, 32-bit, fixed-width) code unit.
Definition Platform.h:1143
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::ANSICHAR ANSICHAR
An ANSI character. Normally a signed type.
Definition Platform.h:1131
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
Definition MemoryWriter.h:101
Definition NameTypes.h:617
Definition StructuredArchiveFormatter.h:60
Definition Text.h:385
Definition Array.h:670
Definition Object.h:95
void WriteValue(FJsonWriterRef Writer, const FString &Key, const ValueType &Value)
Definition NativeJSScripting.cpp:19
void ToJson(TArray< T > &InArray, const ToJsonVariantArgs &InArgs)
Definition JsonSerializable.h:168
Definition PackageReader.cpp:44
Definition StructuredArchiveNameHelpers.h:10
Definition LazyObjectPtr.h:151
Definition ObjectPtr.h:55
Definition SoftObjectPath.h:56
Definition SoftObjectPtr.h:45
Definition WeakObjectPtr.h:49