UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PropertyLocalizationDataGathering.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Array.h"
6#include "Containers/Map.h"
7#include "Containers/Set.h"
9#include "CoreMinimal.h"
10#include "HAL/Platform.h"
13#include "Misc/EnumClassFlags.h"
14#include "Templates/Function.h"
15#include "Templates/TypeHash.h"
16#include "Templates/UniquePtr.h"
17
18class FProperty;
19class FText;
20class UClass;
21class UFunction;
22class UObject;
23class UPackage;
24class UScriptStruct;
25class UStruct;
27
78
80{
84 Empty = 0,
85
89 HasText = 1<<0,
90
94 HasScript = 1<<1,
95
100
105};
107
109{
110public:
111 typedef TFunction<void(const UObject* /*Object*/, FPropertyLocalizationDataGatherer& /*PropertyLocalizationDataGatherer*/, const EPropertyLocalizationGathererTextFlags /*GatherTextFlags*/)> FLocalizationDataObjectGatheringCallback;
113
114 typedef TFunction<void(const FString& /*PathToParent*/, const UScriptStruct* /*Struct*/, const void* /*StructData*/, const void* /*DefaultStructData*/, FPropertyLocalizationDataGatherer& /*PropertyLocalizationDataGatherer*/, const EPropertyLocalizationGathererTextFlags /*GatherTextFlags*/)> FLocalizationDataStructGatheringCallback;
116
132
134
135 // Non-copyable
138
142
143 COREUOBJECT_API void GatherLocalizationDataFromStructWithCallbacks(const FString& PathToParent, const UScriptStruct* Struct, const void* StructData, const void* DefaultStructData, const EPropertyLocalizationGathererTextFlags GatherTextFlags);
144 COREUOBJECT_API void GatherLocalizationDataFromStruct(const FString& PathToParent, const UScriptStruct* Struct, const void* StructData, const void* DefaultStructData, const EPropertyLocalizationGathererTextFlags GatherTextFlags);
145 COREUOBJECT_API void GatherLocalizationDataFromStructFields(const FString& PathToParent, const UStruct* Struct, const void* StructData, const void* DefaultStructData, const EPropertyLocalizationGathererTextFlags GatherTextFlags);
146
147 COREUOBJECT_API void GatherLocalizationDataFromChildTextProperties(const FString& PathToParent, const FProperty* const Property, const void* const ValueAddress, const void* const DefaultValueAddress, const EPropertyLocalizationGathererTextFlags GatherTextFlags);
148
149 COREUOBJECT_API void GatherTextInstance(const FText& Text, const FString& Description, const bool bIsEditorOnly);
150 COREUOBJECT_API void GatherScriptBytecode(const FString& PathToScript, const TArray<uint8>& ScriptData, const bool bIsEditorOnly);
151
154
157
159
161
162 static COREUOBJECT_API bool ExtractTextIdentity(const FText& Text, FString& OutNamespace, FString& OutKey, const bool bCleanNamespace);
163
166
168 {
169 return GatherableTextDataArray;
170 }
171
173 {
174 return AllObjectsInPackage.Contains(Object);
175 }
176
177private:
178 COREUOBJECT_API const FGatherableFieldsForType& CacheGatherableFieldsForType(const UStruct* InType);
179 COREUOBJECT_API bool CanGatherFromInnerProperty(const FProperty* InInnerProperty);
180
181 struct FObjectAndGatherFlags
182 {
183 FObjectAndGatherFlags(const UObject* InObject, const EPropertyLocalizationGathererTextFlags InGatherTextFlags)
184 : Object(InObject)
185 , GatherTextFlags(InGatherTextFlags)
186 , KeyHash(0)
187 {
188 KeyHash = HashCombine(KeyHash, GetTypeHash(Object));
189 KeyHash = HashCombine(KeyHash, GetTypeHash(GatherTextFlags));
190 }
191
192 inline bool operator==(const FObjectAndGatherFlags& Other) const
193 {
194 return Object == Other.Object
195 && GatherTextFlags == Other.GatherTextFlags;
196 }
197
198 UE_FORCEINLINE_HINT bool operator!=(const FObjectAndGatherFlags& Other) const
199 {
200 return !(*this == Other);
201 }
202
203 friend inline uint32 GetTypeHash(const FObjectAndGatherFlags& Key)
204 {
205 return Key.KeyHash;
206 }
207
208 const UObject* Object;
210 uint32 KeyHash;
211 };
212
213 TArray<FGatherableTextData>& GatherableTextDataArray;
214 const UPackage* Package;
215 FString PackageNamespace;
218 TSet<const UObject*> AllObjectsInPackage;
219 TSet<FObjectAndGatherFlags> ProcessedObjects;
220 TSet<FObjectAndGatherFlags> BytecodePendingGather;
221 TSet<FTextId> DefaultTextInstances;
222};
223
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define UE_FORCEINLINE_HINT
Definition Platform.h:723
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
EPropertyLocalizationGathererResultFlags
Definition PropertyLocalizationDataGathering.h:80
EPropertyLocalizationGathererTextFlags
Definition PropertyLocalizationDataGathering.h:29
constexpr uint32 HashCombine(uint32 A, uint32 C)
Definition TypeHash.h:36
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition PropertyLocalizationDataGathering.h:109
COREUOBJECT_API void GatherLocalizationDataFromObject(const UObject *Object, const EPropertyLocalizationGathererTextFlags GatherTextFlags)
Definition PropertyLocalizationDataGathering.cpp:222
COREUOBJECT_API void GatherTextInstance(const FText &Text, const FString &Description, const bool bIsEditorOnly)
Definition PropertyLocalizationDataGathering.cpp:559
TMap< const UClass *, FLocalizationDataObjectGatheringCallback > FLocalizationDataObjectGatheringCallbackMap
Definition PropertyLocalizationDataGathering.h:112
static COREUOBJECT_API FLocalizationDataStructGatheringCallbackMap & GetTypeSpecificLocalizationDataStructGatheringCallbacks()
Definition PropertyLocalizationDataGathering.cpp:868
COREUOBJECT_API void GatherScriptBytecode(const FString &PathToScript, const TArray< uint8 > &ScriptData, const bool bIsEditorOnly)
Definition PropertyLocalizationDataGathering.cpp:796
FPropertyLocalizationDataGatherer(const FPropertyLocalizationDataGatherer &)=delete
FPropertyLocalizationDataGatherer & operator=(const FPropertyLocalizationDataGatherer &)=delete
COREUOBJECT_API void MarkDefaultTextInstance(const FText &Text)
Definition PropertyLocalizationDataGathering.cpp:816
static COREUOBJECT_API FLocalizationDataObjectGatheringCallbackMap & GetTypeSpecificLocalizationDataObjectGatheringCallbacks()
Definition PropertyLocalizationDataGathering.cpp:862
COREUOBJECT_API void GatherLocalizationDataFromObjectFields(const FString &PathToParent, const UObject *Object, const EPropertyLocalizationGathererTextFlags GatherTextFlags)
Definition PropertyLocalizationDataGathering.cpp:279
COREUOBJECT_API void GatherLocalizationDataFromStruct(const FString &PathToParent, const UScriptStruct *Struct, const void *StructData, const void *DefaultStructData, const EPropertyLocalizationGathererTextFlags GatherTextFlags)
Definition PropertyLocalizationDataGathering.cpp:320
UE_FORCEINLINE_HINT bool IsObjectValidForGather(const UObject *Object) const
Definition PropertyLocalizationDataGathering.h:172
COREUOBJECT_API void MarkObjectProcessed(const UObject *Object, const EPropertyLocalizationGathererTextFlags GatherTextFlags)
Definition PropertyLocalizationDataGathering.cpp:72
COREUOBJECT_API bool IsDefaultTextInstance(const FText &Text) const
Definition PropertyLocalizationDataGathering.cpp:805
COREUOBJECT_API void GatherLocalizationDataFromChildTextProperties(const FString &PathToParent, const FProperty *const Property, const void *const ValueAddress, const void *const DefaultValueAddress, const EPropertyLocalizationGathererTextFlags GatherTextFlags)
Definition PropertyLocalizationDataGathering.cpp:348
TFunction< void(const FString &, const UScriptStruct *, const void *, const void *, FPropertyLocalizationDataGatherer &, const EPropertyLocalizationGathererTextFlags)> FLocalizationDataStructGatheringCallback
Definition PropertyLocalizationDataGathering.h:114
COREUOBJECT_API const FGatherableFieldsForType & GetGatherableFieldsForType(const UStruct *InType)
Definition PropertyLocalizationDataGathering.cpp:77
static COREUOBJECT_API bool IsEditorOnlyProperty(const FProperty *Property)
Definition PropertyLocalizationDataGathering.cpp:826
COREUOBJECT_API void GatherLocalizationDataFromStructFields(const FString &PathToParent, const UStruct *Struct, const void *StructData, const void *DefaultStructData, const EPropertyLocalizationGathererTextFlags GatherTextFlags)
Definition PropertyLocalizationDataGathering.cpp:325
COREUOBJECT_API bool ShouldProcessObject(const UObject *Object, const EPropertyLocalizationGathererTextFlags GatherTextFlags) const
Definition PropertyLocalizationDataGathering.cpp:59
COREUOBJECT_API void GatherLocalizationDataFromObjectWithCallbacks(const UObject *Object, const EPropertyLocalizationGathererTextFlags GatherTextFlags)
Definition PropertyLocalizationDataGathering.cpp:196
UE_FORCEINLINE_HINT TArray< FGatherableTextData > & GetGatherableTextDataArray() const
Definition PropertyLocalizationDataGathering.h:167
TMap< const UScriptStruct *, FLocalizationDataStructGatheringCallback > FLocalizationDataStructGatheringCallbackMap
Definition PropertyLocalizationDataGathering.h:115
static COREUOBJECT_API bool ExtractTextIdentity(const FText &Text, FString &OutNamespace, FString &OutKey, const bool bCleanNamespace)
Definition PropertyLocalizationDataGathering.cpp:846
TFunction< void(const UObject *, FPropertyLocalizationDataGatherer &, const EPropertyLocalizationGathererTextFlags)> FLocalizationDataObjectGatheringCallback
Definition PropertyLocalizationDataGathering.h:111
COREUOBJECT_API void GatherLocalizationDataFromStructWithCallbacks(const FString &PathToParent, const UScriptStruct *Struct, const void *StructData, const void *DefaultStructData, const EPropertyLocalizationGathererTextFlags GatherTextFlags)
Definition PropertyLocalizationDataGathering.cpp:307
Definition UnrealType.h:174
Definition Text.h:385
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
Definition AndroidPlatformMisc.h:14
Definition UnrealString.h.inl:34
Definition Class.h:3793
Definition Class.h:2476
Definition Object.h:95
Definition Package.h:216
Definition Class.h:1720
Definition Class.h:480
@ Object
Definition TokenizedMessage.h:43
uint32 GetTypeHash(const FKey &Key)
Definition BlackboardKey.h:35
bool operator!=(const FCachedAssetKey &A, const FCachedAssetKey &B)
Definition AssetDataMap.h:506
bool operator==(const FCachedAssetKey &A, const FCachedAssetKey &B)
Definition AssetDataMap.h:501
Definition PropertyLocalizationDataGathering.h:226
UE_FORCEINLINE_HINT FAutoRegisterLocalizationDataGatheringCallback(const UScriptStruct *InStruct, const FPropertyLocalizationDataGatherer::FLocalizationDataStructGatheringCallback &InCallback)
Definition PropertyLocalizationDataGathering.h:232
UE_FORCEINLINE_HINT FAutoRegisterLocalizationDataGatheringCallback(const UClass *InClass, const FPropertyLocalizationDataGatherer::FLocalizationDataObjectGatheringCallback &InCallback)
Definition PropertyLocalizationDataGathering.h:227
Definition GatherableTextData.h:47
Definition PropertyLocalizationDataGathering.h:118
const FLocalizationDataObjectGatheringCallback * CustomObjectCallback
Definition PropertyLocalizationDataGathering.h:121
bool IsEmpty() const
Definition PropertyLocalizationDataGathering.h:124
const FLocalizationDataStructGatheringCallback * CustomStructCallback
Definition PropertyLocalizationDataGathering.h:122
TArray< const FProperty * > Properties
Definition PropertyLocalizationDataGathering.h:119
TArray< const UFunction * > Functions
Definition PropertyLocalizationDataGathering.h:120