UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PathTree.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Map.h"
6#include "Containers/Set.h"
7#include "HAL/Platform.h"
8#include "UObject/NameTypes.h"
9
10template <typename FuncType> class TFunctionRef;
11
13{
14public:
16
20
22 ASSETREGISTRY_API bool CachePath(FName Path, TFunctionRef<void(FName)> OnPathAdded);
23
25 ASSETREGISTRY_API bool RemovePath(FName Path, TFunctionRef<void(FName)> OnPathRemoved);
26
28 ASSETREGISTRY_API bool PathExists(FName Path) const;
29
32
34 ASSETREGISTRY_API void EnumerateAllPaths(TFunctionRef<bool(FName)> Callback) const;
35
37 ASSETREGISTRY_API bool GetSubPaths(FName BasePath, TSet<FName>& OutPaths, bool bRecurse = true) const;
38
40 ASSETREGISTRY_API bool EnumerateSubPaths(FName BasePath, TFunctionRef<bool(FName)> Callback, bool bRecurse = true) const;
41
44
46 {
47 return ParentPathToChildPaths.Num();
48 }
49
51 {
52 SIZE_T AllocatedSize = ParentPathToChildPaths.GetAllocatedSize() + ChildPathToParentPath.GetAllocatedSize();
53
54 for (const TPair<FName, TSet<FName>>& Pair : ParentPathToChildPaths)
55 {
56 AllocatedSize += Pair.Value.GetAllocatedSize();
57 }
58
59 return AllocatedSize;
60 }
61
64
65private:
67 TMap<FName, TSet<FName>> ParentPathToChildPaths;
68
70 TMap<FName, FName> ChildPathToParentPath;
71};
FPlatformTypes::SIZE_T SIZE_T
An unsigned integer the same size as a pointer, the same as UPTRINT.
Definition Platform.h:1150
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
Definition NameTypes.h:617
Definition PathTree.h:13
static ASSETREGISTRY_API FName NormalizePackagePath(FName In)
Definition PathTree.cpp:193
ASSETREGISTRY_API bool EnumerateSubPaths(FName BasePath, TFunctionRef< bool(FName)> Callback, bool bRecurse=true) const
Definition PathTree.cpp:204
ASSETREGISTRY_API bool RemovePath(FName Path, TFunctionRef< void(FName)> OnPathRemoved)
Definition PathTree.cpp:86
ASSETREGISTRY_API void EnsureAdditionalCapacity(int32 NumNewPaths)
Definition PathTree.cpp:17
SIZE_T GetAllocatedSize(void) const
Definition PathTree.h:50
ASSETREGISTRY_API void EnumerateAllPaths(TFunctionRef< bool(FName)> Callback) const
Definition PathTree.cpp:172
ASSETREGISTRY_API bool GetAllPaths(TSet< FName > &OutPaths) const
Definition PathTree.cpp:161
ASSETREGISTRY_API FPathTree()
Definition PathTree.cpp:9
int32 NumPaths() const
Definition PathTree.h:45
ASSETREGISTRY_API bool CachePath(FName Path, TFunctionRef< void(FName)> OnPathAdded)
Definition PathTree.cpp:23
ASSETREGISTRY_API bool PathExists(FName Path) const
Definition PathTree.cpp:136
ASSETREGISTRY_API void Shrink()
Definition PathTree.cpp:249
ASSETREGISTRY_API bool GetSubPaths(FName BasePath, TSet< FName > &OutPaths, bool bRecurse=true) const
Definition PathTree.cpp:183
Definition AssetRegistryState.h:50
Definition UnrealString.h.inl:34
Definition Tuple.h:652