UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PackageId.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"
7#include "HAL/Platform.h"
9#include "UObject/NameTypes.h"
10
11class FArchive;
13
14#ifndef WITH_PACKAGEID_NAME_MAP
15#define WITH_PACKAGEID_NAME_MAP WITH_EDITOR
16#endif
17
19{
20 static constexpr uint64 InvalidId = 0;
21 uint64 Id = InvalidId;
22
23 inline explicit FPackageId(uint64 InId): Id(InId) {}
24
25public:
26 constexpr FPackageId() = default;
27
28 CORE_API static FPackageId FromName(const FName& Name);
29
31 {
32 return FPackageId(Value);
33 }
34
35 inline bool IsValid() const
36 {
37 return Id != InvalidId;
38 }
39
40 inline uint64 Value() const
41 {
42 return Id;
43 }
44
45 UE_DEPRECATED(5.5, "Use LexToString()")
47 {
48 return Id;
49 }
50
51 inline bool operator<(FPackageId Other) const
52 {
53 return Id < Other.Id;
54 }
55
56 inline bool operator==(FPackageId Other) const
57 {
58 return Id == Other.Id;
59 }
60
61 inline bool operator!=(FPackageId Other) const
62 {
63 return Id != Other.Id;
64 }
65
66 inline friend uint32 GetTypeHash(const FPackageId& In)
67 {
68 return uint32(In.Id);
69 }
70
72
74
75 CORE_API friend void SerializeForLog(FCbWriter& Writer, const FPackageId& Value);
76
77#if WITH_PACKAGEID_NAME_MAP
78 CORE_API FName GetName() const;
79#endif
80};
81
82CORE_API FString LexToString(const FPackageId& PackageId);
83
84template <typename CharType>
86{
87 Builder.Appendf(CHARTEXT(CharType, "0x%llX"), PackageId.Value());
88#if WITH_PACKAGEID_NAME_MAP
89 Builder << " (" << PackageId.GetName() << ")";
90#endif // WITH_PACKAGEID_NAME_MAP
91 return Builder;
92}
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
#define CHARTEXT(CharType, x)
Definition Platform.h:1291
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
CORE_API FString LexToString(const FPackageId &PackageId)
Definition PackageId.cpp:91
TStringBuilderBase< CharType > & operator<<(TStringBuilderBase< CharType > &Builder, const FPackageId &PackageId)
Definition PackageId.h:85
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
Definition CompactBinaryWriter.h:68
Definition NameTypes.h:617
Definition PackageId.h:19
static FPackageId FromValue(const uint64 Value)
Definition PackageId.h:30
constexpr FPackageId()=default
friend uint32 GetTypeHash(const FPackageId &In)
Definition PackageId.h:66
CORE_API friend FArchive & operator<<(FArchive &Ar, FPackageId &Value)
Definition PackageId.cpp:57
bool operator!=(FPackageId Other) const
Definition PackageId.h:61
CORE_API friend void SerializeForLog(FCbWriter &Writer, const FPackageId &Value)
Definition PackageId.cpp:68
bool operator<(FPackageId Other) const
Definition PackageId.h:51
uint64 Value() const
Definition PackageId.h:40
bool IsValid() const
Definition PackageId.h:35
static CORE_API FPackageId FromName(const FName &Name)
Definition PackageId.cpp:26
uint64 ValueForDebugging() const
Definition PackageId.h:46
bool operator==(FPackageId Other) const
Definition PackageId.h:56
Definition StructuredArchiveSlots.h:52
Definition StringBuilder.h:79
BuilderType & Appendf(const FmtType &Fmt, Types... Args)
Definition StringBuilder.h:419