UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ObjectPathId.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"
10#include "HAL/Platform.h"
11#include "Templates/TypeHash.h"
12#include "UObject/NameTypes.h"
13
14class FLinkerTables;
15class UObject;
16struct FObjectImport;
17struct FObjectRef;
18
19// Declared in the header so the type exists in debug info for debugger visualization, not a public part of the API.
21{
22 struct FPackedObjectRef;
23
46
47 // @TODO: OBJPTR: Should this be changed to FObjectImportPathId? It is already written to target the specific patterns in import paths,
48 // if we go further in the future and do things like store classname/classpackage info, to the path segments, it would be
49 // even more specific to imports.
50
63 {
64 public:
65 FObjectPathId() = default;
67 explicit FObjectPathId(const UObject* Object);
69
70 enum EInvalid { Invalid = 0 };
71
73 : Index(0)
74 , Number(SimpleNameMask | WeakObjectMask)
75 {
76 }
77
79
82
84 inline bool operator==(const FObjectPathId& Other) const { return Index == Other.Index && Number == Other.Number; }
85 inline bool IsNone() const { return Index == 0 && Number == 0; }
86 inline bool IsValid() const { return Number != (SimpleNameMask | WeakObjectMask); }
87 inline bool IsSimple() const { return IsValid() && Number & SimpleNameMask; }
88 inline bool IsWeakObj() const { return IsValid() && Number & WeakObjectMask; }
89
90 // @TODO: OBJPTR: Is there a better interface to output the resolved name without:
91 // 1) Requiring multiple lookups in the table in case of complex paths
92 // 2) Requiring string allocation
93 // 3) Constraining how we might change the internal storage of object paths in the future
98 void MakeWeakObjPtr(const UObject& Object);
99 const FStoredObjectPath& GetStoredPath() const;
100
101 void Reset()
102 {
103 Index = 0;
104 Number = 0;
105 }
106 private:
107
108 template <typename NameProducerType>
109 void StoreObjectPathId(NameProducerType& NameProducer);
110
111 static constexpr uint32 WeakObjectMask = ~((~0u) >> 1); //most significant bit
112 static constexpr uint32 SimpleNameMask = WeakObjectMask >> 1; //second most significant bits
113
114 uint32 Index = 0;
115 uint32 Number = 0;
116
121 };
122}
#define FORCEINLINE
Definition AndroidPlatform.h:140
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
constexpr uint32 HashCombineFast(uint32 A, uint32 B)
Definition TypeHash.h:74
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Linker.h:65
Definition NameTypes.h:617
Definition Array.h:670
Definition StringView.h:107
Definition ObjectPathId.h:63
FObjectPathId(EInvalid)
Definition ObjectPathId.h:72
EInvalid
Definition ObjectPathId.h:70
@ Invalid
Definition ObjectPathId.h:70
void Reset()
Definition ObjectPathId.h:101
bool IsValid() const
Definition ObjectPathId.h:86
bool IsWeakObj() const
Definition ObjectPathId.h:88
bool IsNone() const
Definition ObjectPathId.h:85
FObjectPathId & operator=(const FObjectPathId &Other)=default
const FStoredObjectPath & GetStoredPath() const
Definition ObjectPathId.cpp:391
bool IsSimple() const
Definition ObjectPathId.h:87
FMinimalName GetSimpleName() const
Definition ObjectPathId.cpp:353
static FName MakeImportPathIdAndPackageName(const FObjectImport &Import, const FLinkerTables &LinkerTables, FObjectPathId &OutPathId)
Definition ObjectPathId.cpp:231
void MakeWeakObjPtr(const UObject &Object)
Definition ObjectPathId.cpp:364
bool operator==(const FObjectPathId &Other) const
Definition ObjectPathId.h:84
friend FORCEINLINE uint32 GetTypeHash(FObjectPathId Value)
Definition ObjectPathId.h:117
FWeakObjectPtr GetWeakObjPtr() const
Definition ObjectPathId.cpp:375
FObjectPathId(const FObjectPathId &Other)=default
Definition Object.h:95
Definition CoreGlobals.cpp:268
U16 Index
Definition radfft.cpp:71
Definition NameTypes.h:439
Definition ObjectResource.h:444
Definition WeakObjectPtr.h:49
int32 NumElements
Definition ObjectPathId.h:27
TConstArrayView< FMinimalName > GetView() const
Definition ObjectPathId.cpp:132
const FMinimalName * GetData() const
Definition ObjectPathId.h:44
~FStoredObjectPath()
Definition ObjectPathId.cpp:102
static constexpr const int32 NumInlineElements
Definition ObjectPathId.h:26
FStoredObjectPath & operator=(const FStoredObjectPath &)=delete
FStoredObjectPath(const FStoredObjectPath &)=delete
FMinimalName Short[NumInlineElements]
Definition ObjectPathId.h:31
FMinimalName * Long
Definition ObjectPathId.h:32