UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
BlueprintMapLibrary.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "UObject/Script.h"
11#include "BlueprintMapLibrary.generated.h"
12
13UCLASS(meta=(BlueprintThreadSafe), MinimalAPI)
15{
17
18public:
27 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Add", CompactNodeTitle = "ADD", MapParam = "TargetMap", MapKeyParam = "Key", MapValueParam = "Value", AutoCreateRefTerm = "Key, Value"), Category = "Utilities|Map")
28 static ENGINE_API void Map_Add(const TMap<int32, int32>& TargetMap, const int32& Key, const int32& Value);
29
37 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Remove", CompactNodeTitle = "REMOVE", MapParam = "TargetMap", MapKeyParam = "Key", AutoCreateRefTerm = "Key"), Category = "Utilities|Map")
38 static ENGINE_API bool Map_Remove(const TMap<int32, int32>& TargetMap, const int32& Key);
39
48 UFUNCTION(BlueprintPure, CustomThunk, meta=(DisplayName = "Find", CompactNodeTitle = "FIND", MapParam = "TargetMap", MapKeyParam = "Key", MapValueParam = "Value", AutoCreateRefTerm = "Key, Value", BlueprintThreadSafe), Category = "Utilities|Map")
49 static ENGINE_API bool Map_Find(const TMap<int32, int32>& TargetMap, const int32& Key, int32& Value);
50
58 UFUNCTION(BlueprintPure, CustomThunk, meta=(DisplayName = "Contains", CompactNodeTitle = "CONTAINS", MapParam = "TargetMap", MapKeyParam = "Key", AutoCreateRefTerm = "Key", BlueprintThreadSafe), Category = "Utilities|Map")
59 static ENGINE_API bool Map_Contains(const TMap<int32, int32>& TargetMap, const int32& Key);
60
67 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Keys", CompactNodeTitle = "KEYS", MapParam = "TargetMap", MapKeyParam = "Keys", AutoCreateRefTerm = "Keys"), Category = "Utilities|Map")
68 static ENGINE_API void Map_Keys(const TMap<int32, int32>& TargetMap, TArray<int32>& Keys);
69
76 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Values", CompactNodeTitle = "VALUES", MapParam = "TargetMap", MapValueParam = "Values", AutoCreateRefTerm = "Values"), Category = "Utilities|Map")
77 static ENGINE_API void Map_Values(const TMap<int32, int32>& TargetMap, TArray<int32>& Values);
78
85 UFUNCTION(BlueprintPure, CustomThunk, meta=(DisplayName = "Length", CompactNodeTitle = "LENGTH", MapParam = "TargetMap", Keywords = "num size count", BlueprintThreadSafe), Category="Utilities|Map")
87
94 UFUNCTION(BlueprintPure, CustomThunk, meta = (DisplayName = "Is Empty", CompactNodeTitle = "IS EMPTY", MapParam = "TargetMap"), Category = "Utilities|Map")
95 static ENGINE_API bool Map_IsEmpty(const TMap<int32, int32>& TargetMap);
96
103 UFUNCTION(BlueprintPure, CustomThunk, meta = (DisplayName = "Is Not Empty", CompactNodeTitle = "IS NOT EMPTY", MapParam = "TargetMap"), Category = "Utilities|Map")
104 static ENGINE_API bool Map_IsNotEmpty(const TMap<int32, int32>& TargetMap);
105
111 UFUNCTION(BlueprintCallable, CustomThunk, meta=(DisplayName = "Clear", CompactNodeTitle = "CLEAR", MapParam = "TargetMap" ), Category = "Utilities|Map")
112 static ENGINE_API void Map_Clear(const TMap<int32, int32>& TargetMap);
113
117 UFUNCTION(BlueprintCallable, CustomThunk, meta=(BlueprintInternalUseOnly = "true", MapParam = "Value"))
118 static ENGINE_API void SetMapPropertyByName(UObject* Object, FName PropertyName, const TMap<int32, int32>& Value);
119
130 UFUNCTION(BlueprintPure, CustomThunk, meta = (DisplayName = "Get Key Value By Index", CompactNodeTitle = "GET KEY VALUE BY INDEX", MapParam = "TargetMap", MapKeyParam = "Key", MapValueParam = "Value", AutoCreateRefTerm = "Key, Value", BlueprintThreadSafe), Category = "Utilities|Map")
131 static ENGINE_API void Map_GetKeyValueByIndex(const TMap<int32, int32>& TargetMap, int32 Index, int32& Key, int32& Value);
132
139 UFUNCTION(BlueprintPure, CustomThunk, meta=(DisplayName = "Get Last Index", CompactNodeTitle = "GET LAST INDEX", MapParam = "TargetMap", BlueprintThreadSafe), Category="Utilities|Map")
140 static ENGINE_API int32 Map_GetLastIndex(const TMap<int32, int32>& TargetMap);
141
143 {
144 Stack.MostRecentProperty = nullptr;
145 Stack.StepCompiledIn<FMapProperty>(NULL);
146 void* MapAddr = Stack.MostRecentPropertyAddress;
147 FMapProperty* MapProperty = CastField<FMapProperty>(Stack.MostRecentProperty);
148 if (!MapProperty)
149 {
150 Stack.bArrayContextFailed = true;
151 return;
152 }
153
154 // Since Key and Value aren't really an int, step the stack manually
155 const FProperty* CurrKeyProp = MapProperty->KeyProp;
158 CurrKeyProp->InitializeValue(KeyStorageSpace);
159
160 Stack.MostRecentPropertyAddress = nullptr;
161 Stack.MostRecentPropertyContainer = nullptr;
162 Stack.StepCompiledIn<FProperty>(KeyStorageSpace);
163
164 const FProperty* CurrValueProp = MapProperty->ValueProp;
167 CurrValueProp->InitializeValue(ValueStorageSpace);
168
169 Stack.MostRecentPropertyAddress = nullptr;
170 Stack.MostRecentPropertyContainer = nullptr;
171 Stack.StepCompiledIn<FProperty>(ValueStorageSpace);
172
173 P_FINISH;
174
178
179 CurrValueProp->DestroyValue(ValueStorageSpace);
180 CurrKeyProp->DestroyValue(KeyStorageSpace);
181 }
182
184 {
185 Stack.MostRecentProperty = nullptr;
186 Stack.StepCompiledIn<FMapProperty>(NULL);
187 void* MapAddr = Stack.MostRecentPropertyAddress;
188 FMapProperty* MapProperty = CastField<FMapProperty>(Stack.MostRecentProperty);
189 if (!MapProperty)
190 {
191 Stack.bArrayContextFailed = true;
192 return;
193 }
194
195 // Since Key and Value aren't really an int, step the stack manually
196 const FProperty* CurrKeyProp = MapProperty->KeyProp;
199 CurrKeyProp->InitializeValue(KeyStorageSpace);
200
201 Stack.MostRecentPropertyAddress = nullptr;
202 Stack.MostRecentPropertyContainer = nullptr;
203 Stack.StepCompiledIn<FProperty>(KeyStorageSpace);
204
205 P_FINISH;
207 *(bool*)RESULT_PARAM = GenericMap_Remove(MapAddr, MapProperty, KeyStorageSpace);
209
211 }
212
214 {
215 Stack.MostRecentProperty = nullptr;
216 Stack.StepCompiledIn<FMapProperty>(NULL);
217 void* MapAddr = Stack.MostRecentPropertyAddress;
218 FMapProperty* MapProperty = CastField<FMapProperty>(Stack.MostRecentProperty);
219 if (!MapProperty)
220 {
221 Stack.bArrayContextFailed = true;
222 return;
223 }
224
225 // Since Key and Value aren't really an int, step the stack manually
226 const FProperty* CurrKeyProp = MapProperty->KeyProp;
229 CurrKeyProp->InitializeValue(KeyStorageSpace);
230
231 Stack.MostRecentPropertyAddress = nullptr;
232 Stack.MostRecentPropertyContainer = nullptr;
233 Stack.StepCompiledIn<FProperty>(KeyStorageSpace);
234
235 const FProperty* CurrValueProp = MapProperty->ValueProp;
238 CurrValueProp->InitializeValue(ValueStorageSpace);
239
240 Stack.MostRecentPropertyAddress = nullptr;
241 Stack.MostRecentPropertyContainer = nullptr;
242 Stack.StepCompiledIn<FProperty>(ValueStorageSpace);
243 const FFieldClass* CurrValuePropClass = CurrValueProp->GetClass();
244 const FFieldClass* MostRecentPropClass = Stack.MostRecentProperty->GetClass();
245 void* ItemPtr;
246 // If the destination and the inner type are identical in size and their field classes derive from one another, then permit the writing out of the array element to the destination memory
247 if (Stack.MostRecentPropertyAddress != NULL && (ValuePropertySize == Stack.MostRecentProperty->GetElementSize()*Stack.MostRecentProperty->ArrayDim) &&
249 {
250 ItemPtr = Stack.MostRecentPropertyAddress;
251 }
252 else
253 {
254 ItemPtr = ValueStorageSpace;
255 }
256
257 P_FINISH;
259 *(bool*)RESULT_PARAM = GenericMap_Find(MapAddr, MapProperty, KeyStorageSpace, ItemPtr);
261
262 CurrValueProp->DestroyValue(ValueStorageSpace);
263 CurrKeyProp->DestroyValue(KeyStorageSpace);
264 }
265
267 {
268 Stack.MostRecentProperty = nullptr;
269 Stack.StepCompiledIn<FMapProperty>(NULL);
270 void* MapAddr = Stack.MostRecentPropertyAddress;
271 FMapProperty* MapProperty = CastField<FMapProperty>(Stack.MostRecentProperty);
272 if (!MapProperty)
273 {
274 Stack.bArrayContextFailed = true;
275 return;
276 }
277
278 Stack.MostRecentProperty = nullptr;
279 Stack.StepCompiledIn<FArrayProperty>(NULL);
280 void* ArrayAddr = Stack.MostRecentPropertyAddress;
281 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
282 if (!ArrayProperty)
283 {
284 Stack.bArrayContextFailed = true;
285 return;
286 }
287
288 P_FINISH;
290 GenericMap_Keys(MapAddr, MapProperty, ArrayAddr, ArrayProperty);
292
293 }
294
296 {
297 Stack.MostRecentProperty = nullptr;
298 Stack.StepCompiledIn<FMapProperty>(NULL);
299 void* MapAddr = Stack.MostRecentPropertyAddress;
300 FMapProperty* MapProperty = CastField<FMapProperty>(Stack.MostRecentProperty);
301 if (!MapProperty)
302 {
303 Stack.bArrayContextFailed = true;
304 return;
305 }
306
307 Stack.MostRecentProperty = nullptr;
308 Stack.StepCompiledIn<FArrayProperty>(NULL);
309 void* ArrayAddr = Stack.MostRecentPropertyAddress;
310 FArrayProperty* ArrayProperty = CastField<FArrayProperty>(Stack.MostRecentProperty);
311 if (!ArrayProperty)
312 {
313 Stack.bArrayContextFailed = true;
314 return;
315 }
316
317 P_FINISH;
319 GenericMap_Values(MapAddr, MapProperty, ArrayAddr, ArrayProperty);
321 }
322
324 {
325 Stack.MostRecentProperty = nullptr;
326 Stack.StepCompiledIn<FMapProperty>(NULL);
327 void* MapAddr = Stack.MostRecentPropertyAddress;
328 FMapProperty* MapProperty = CastField<FMapProperty>(Stack.MostRecentProperty);
329 if (!MapProperty)
330 {
331 Stack.bArrayContextFailed = true;
332 return;
333 }
334
335 // Since Key and Value aren't really an int, step the stack manually
336 const FProperty* CurrKeyProp = MapProperty->KeyProp;
339 CurrKeyProp->InitializeValue(KeyStorageSpace);
340
341 Stack.MostRecentPropertyAddress = nullptr;
342 Stack.MostRecentPropertyContainer = nullptr;
343 Stack.StepCompiledIn<FProperty>(KeyStorageSpace);
344
345 P_FINISH;
347 *(bool*)RESULT_PARAM = GenericMap_Find(MapAddr, MapProperty, KeyStorageSpace, nullptr);
349
351 }
352
354 {
355 Stack.MostRecentProperty = nullptr;
356 Stack.StepCompiledIn<FMapProperty>(NULL);
357 void* MapAddr = Stack.MostRecentPropertyAddress;
358 FMapProperty* MapProperty = CastField<FMapProperty>(Stack.MostRecentProperty);
359 if (!MapProperty)
360 {
361 Stack.bArrayContextFailed = true;
362 return;
363 }
364
365 P_FINISH;
367 *(int32*)RESULT_PARAM = GenericMap_Length(MapAddr, MapProperty);
369 }
370
372 {
373 Stack.MostRecentProperty = nullptr;
374 Stack.StepCompiledIn<FMapProperty>(nullptr);
375 void* MapAddr = Stack.MostRecentPropertyAddress;
376 FMapProperty* MapProperty = CastField<FMapProperty>(Stack.MostRecentProperty);
377 if (!MapProperty)
378 {
379 Stack.bArrayContextFailed = true;
380 return;
381 }
382
383 P_FINISH;
385 *(bool*)RESULT_PARAM = GenericMap_IsEmpty(MapAddr, MapProperty);
387 }
388
390 {
391 Stack.MostRecentProperty = nullptr;
392 Stack.StepCompiledIn<FMapProperty>(nullptr);
393 void* MapAddr = Stack.MostRecentPropertyAddress;
394 FMapProperty* MapProperty = CastField<FMapProperty>(Stack.MostRecentProperty);
395 if (!MapProperty)
396 {
397 Stack.bArrayContextFailed = true;
398 return;
399 }
400
401 P_FINISH;
403 *(bool*)RESULT_PARAM = GenericMap_IsNotEmpty(MapAddr, MapProperty);
405 }
406
408 {
409 Stack.MostRecentProperty = nullptr;
410 Stack.StepCompiledIn<FMapProperty>(NULL);
411 void* MapAddr = Stack.MostRecentPropertyAddress;
412 FMapProperty* MapProperty = CastField<FMapProperty>(Stack.MostRecentProperty);
413 if (!MapProperty)
414 {
415 Stack.bArrayContextFailed = true;
416 return;
417 }
418
419 P_FINISH;
421 GenericMap_Clear(MapAddr, MapProperty);
423 }
424
426 {
429
430 Stack.StepCompiledIn<FMapProperty>(nullptr);
431 void* SrcMapAddr = Stack.MostRecentPropertyAddress;
432
433 P_FINISH;
434
436 GenericMap_SetMapPropertyByName(OwnerObject, MapPropertyName, SrcMapAddr);
438 }
439
441 {
442 Stack.MostRecentProperty = nullptr;
443 Stack.StepCompiledIn<FMapProperty>(nullptr);
444 void* MapAddr = Stack.MostRecentPropertyAddress;
445 FMapProperty* MapProperty = CastField<FMapProperty>(Stack.MostRecentProperty);
446 if (!MapProperty)
447 {
448 Stack.bArrayContextFailed = true;
449 return;
450 }
452
453 // Since Key isn't really an int, step the stack manually
454 const FProperty* CurrKeyProp = MapProperty->KeyProp;
457 CurrKeyProp->InitializeValue(KeyStorageSpace);
458
459 Stack.MostRecentPropertyAddress = nullptr;
460 Stack.MostRecentPropertyContainer = nullptr;
461 Stack.StepCompiledIn<FProperty>(KeyStorageSpace);
462 const FFieldClass* CurrKeyPropClass = CurrKeyProp->GetClass();
463 const FFieldClass* MostRecentPropClass = Stack.MostRecentProperty->GetClass();
464
465 // If the destination and the inner type are identical in size and their field classes derive from one another, then permit the writing out of the array element to the destination memory
466 void* KeyPtr = KeyStorageSpace;
467 if (Stack.MostRecentPropertyAddress != nullptr && (KeyPropertySize == Stack.MostRecentProperty->GetElementSize() * Stack.MostRecentProperty->ArrayDim) &&
469 {
470 KeyPtr = Stack.MostRecentPropertyAddress;
471 }
472
473 // Since the Value isn't really an int, step the stack manually
474 const FProperty* CurrValueProp = MapProperty->ValueProp;
477 CurrValueProp->InitializeValue(ValueStorageSpace);
478
479 Stack.MostRecentPropertyAddress = nullptr;
480 Stack.MostRecentPropertyContainer = nullptr;
481 Stack.StepCompiledIn<FProperty>(ValueStorageSpace);
482 const FFieldClass* CurrValuePropClass = CurrValueProp->GetClass();
483 MostRecentPropClass = Stack.MostRecentProperty->GetClass();
484
485 // If the destination and the inner type are identical in size and their field classes derive from one another, then permit the writing out of the array element to the destination memory
486 void* ItemPtr = ValueStorageSpace;
487 if (Stack.MostRecentPropertyAddress != nullptr && (ValuePropertySize == Stack.MostRecentProperty->GetElementSize() * Stack.MostRecentProperty->ArrayDim) &&
489 {
490 ItemPtr = Stack.MostRecentPropertyAddress;
491 }
492
493 P_FINISH;
495 GenericMap_GetKeyValueByIndex(MapAddr, MapProperty, Index, KeyPtr, ItemPtr);
497
498 CurrValueProp->DestroyValue(ValueStorageSpace);
499 CurrKeyProp->DestroyValue(KeyStorageSpace);
500 }
501
503 {
504 Stack.MostRecentProperty = nullptr;
505 Stack.StepCompiledIn<FMapProperty>(nullptr);
506 void *MapAddr = Stack.MostRecentPropertyAddress;
507 FMapProperty* MapProperty = CastField<FMapProperty>(Stack.MostRecentProperty);
508 if (!MapProperty)
509 {
510 Stack.bArrayContextFailed = true;
511 return;
512 }
513
514 P_FINISH;
516 *(int32*)RESULT_PARAM = GenericMap_GetLastIndex(MapAddr, MapProperty);
518 }
519
520 static ENGINE_API void GenericMap_Add(const void* TargetMap, const FMapProperty* MapProperty, const void* KeyPtr, const void* ValuePtr);
521 static ENGINE_API bool GenericMap_Remove(const void* TargetMap, const FMapProperty* MapProperty, const void* KeyPtr);
522 static ENGINE_API bool GenericMap_Find(const void* TargetMap, const FMapProperty* MapProperty, const void* KeyPtr, void* ValuePtr);
523 static ENGINE_API void GenericMap_Keys(const void* MapAddr, const FMapProperty* MapProperty, const void* ArrayAddr, const FArrayProperty* ArrayProperty);
524 static ENGINE_API void GenericMap_Values(const void* MapAddr, const FMapProperty* MapProperty, const void* ArrayAddr, const FArrayProperty* ArrayProperty);
525 static ENGINE_API int32 GenericMap_Length(const void* TargetMap, const FMapProperty* MapProperty);
526 static ENGINE_API bool GenericMap_IsEmpty(const void* TargetMap, const FMapProperty* MapProperty);
527 static ENGINE_API bool GenericMap_IsNotEmpty(const void* TargetMap, const FMapProperty* MapProperty);
528 static ENGINE_API void GenericMap_Clear(const void* TargetMap, const FMapProperty* MapProperty);
529 static ENGINE_API void GenericMap_SetMapPropertyByName(UObject* OwnerObject, FName MapPropertyName, const void* SrcMapAddr);
530 static ENGINE_API void GenericMap_GetKeyValueByIndex(const void* TargetMap, const FMapProperty* MapProperty, int32 Index, void* KeyPtr, void* ValuePtr);
531 static ENGINE_API int32 GenericMap_GetLastIndex(const void* TargetMap, const FMapProperty* MapProperty);
532
533private:
534 static constexpr int32 MaxSupportedMapSize = TNumericLimits<int32>::Max();
535};
#define NULL
Definition oodle2base.h:134
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
#define FMemory_Alloca(Size)
Definition GenericPlatformMemory.h:218
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define DECLARE_FUNCTION(func)
Definition ObjectMacros.h:783
#define UCLASS(...)
Definition ObjectMacros.h:776
#define P_FINISH
Definition ScriptMacros.h:141
#define P_GET_PROPERTY(PropertyType, ParamName)
Definition ScriptMacros.h:51
#define P_GET_OBJECT(ObjectType, ParamName)
Definition ScriptMacros.h:71
#define P_NATIVE_END
Definition ScriptMacros.h:148
#define P_NATIVE_BEGIN
Definition ScriptMacros.h:147
#define RESULT_PARAM
Definition Script.h:91
Definition UnrealType.h:3702
Definition Field.h:66
Definition UnrealType.h:2304
Definition UnrealType.h:3843
Definition UnrealType.h:3649
Definition NameTypes.h:617
Definition UnrealType.h:174
void DestroyValue(void *Dest) const
Definition UnrealType.h:1025
int32 GetElementSize() const
Definition UnrealType.h:291
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition BlueprintFunctionLibrary.h:16
Definition BlueprintMapLibrary.h:15
DECLARE_FUNCTION(execMap_Contains)
Definition BlueprintMapLibrary.h:323
DECLARE_FUNCTION(execSetMapPropertyByName)
Definition BlueprintMapLibrary.h:425
DECLARE_FUNCTION(execMap_Values)
Definition BlueprintMapLibrary.h:295
DECLARE_FUNCTION(execMap_GetLastIndex)
Definition BlueprintMapLibrary.h:502
DECLARE_FUNCTION(execMap_Length)
Definition BlueprintMapLibrary.h:353
DECLARE_FUNCTION(execMap_Find)
Definition BlueprintMapLibrary.h:213
DECLARE_FUNCTION(execMap_Remove)
Definition BlueprintMapLibrary.h:183
DECLARE_FUNCTION(execMap_Clear)
Definition BlueprintMapLibrary.h:407
DECLARE_FUNCTION(execMap_IsEmpty)
Definition BlueprintMapLibrary.h:371
DECLARE_FUNCTION(execMap_Keys)
Definition BlueprintMapLibrary.h:266
DECLARE_FUNCTION(execMap_GetKeyValueByIndex)
Definition BlueprintMapLibrary.h:440
DECLARE_FUNCTION(execMap_IsNotEmpty)
Definition BlueprintMapLibrary.h:389
Definition Object.h:95
U16 Index
Definition radfft.cpp:71
Definition NumericLimits.h:41