UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
BulkDataCookedIndex.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
8#include "Misc/PathViews.h"
11#include "String/Numeric.h"
12
13// When this is enabled the default value for FBulkDataCookedIndex, meaning that the bulkdata does not use the
14// system will be 0, if it is disabled we will use the max value allowed for FBulkDataCookedIndex::Type.
15// If the default is zero then we cannot use <packagename>.000.ubulk as will start indexing from .001.ubulk instead
16// but it also means that the FChunkId for a payload not using the system will remain unchanged.
17#define UE_DEFAULT_ZERO 1
18
19
20#define UE_DISABLE_COOKEDINDEX_FOR_MEMORYMAPPED 1
21
22#define UE_DISABLE_COOKEDINDEX_FOR_NONDUPLICATE 1
23
25{
26 Inline, // Stored inside the export data in .uexp
27 AppendToExports, // Stored after the export data in .uexp
28 BulkSegment, // Stored in .ubulk
29 Optional, // Stored in .uptnl
30 MemoryMapped, // Stored in .m.bulk
31};
32
34{
35public:
36 // It is likely that we will want to expand the number of bits that this system currently uses when addressed
37 // via FIoChunkIds in the future. The following constants and aliases make it easier to track places in the
38 // code base that make assumptions about this so we can safely update them all at once.
40 constexpr static int32 MAX_DIGITS = 3;
41
43
46 : Value(InValue)
47 {
48
49 }
50
52
53 bool IsDefault() const
54 {
55#if UE_DEFAULT_ZERO
56 return Value == 0;
57#else
58 return Value == TNumericLimits<ValueType>::Max();
59#endif //UE_DEFAULT_ZERO
60 }
61
62 FString GetAsExtension() const
63 {
64 if (IsDefault())
65 {
66 return FString();
67 }
68 else
69 {
70 return FString::Printf(TEXT(".%03hhu"), Value);
71 }
72 }
73
75 {
76 return Value;
77 }
78
80 {
81 return Value == Other.Value;
82 }
83
85 {
86 return Value < Other.Value;
87 }
88
90 {
91 Slot << ChunkGroup.Value;
92 }
93
95 {
96 return GetTypeHash(ChunkGroup.Value);
97 }
98
99 // TODO: Unit tests
101 {
103 for (int32 Index = Path.Len() - 1; Index >= 0; --Index)
104 {
106 {
107 return FBulkDataCookedIndex();
108 }
109 else if (Path[Index] == '.')
110 {
111 if (ExtensionStartIndex != -1)
112 {
113 FStringView Extension = Path.SubStr(Index + 1, (ExtensionStartIndex - Index) - 1);
114 if (UE::String::IsNumericOnlyDigits(Extension))
115 {
116 ValueType Value = 0;
117 LexFromString(Value, Extension);
118
119 return FBulkDataCookedIndex(Value);
120 }
121 else
122 {
123 return FBulkDataCookedIndex();
124 }
125 }
126 else
127 {
129 }
130 }
131 }
132
133 return FBulkDataCookedIndex();
134 }
135
136private:
137#if UE_DEFAULT_ZERO
138 ValueType Value = 0;
139#else
141#endif //UE_DEFAULT_ZERO
142};
143
144#undef UE_DEFAULT_ZERO
EBulkDataPayloadType
Definition BulkDataCookedIndex.h:25
#define TEXT(x)
Definition Platform.h:1272
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
void LexFromString(EAudioFeature &OutFeature, const TCHAR *String)
Definition IOSAppDelegate.cpp:163
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition BulkDataCookedIndex.h:34
ValueType GetValue() const
Definition BulkDataCookedIndex.h:74
friend uint32 GetTypeHash(const FBulkDataCookedIndex &ChunkGroup)
Definition BulkDataCookedIndex.h:94
uint8 ValueType
Definition BulkDataCookedIndex.h:39
bool operator<(const FBulkDataCookedIndex &Other) const
Definition BulkDataCookedIndex.h:84
FString GetAsExtension() const
Definition BulkDataCookedIndex.h:62
friend void operator<<(FStructuredArchive::FSlot Slot, FBulkDataCookedIndex &ChunkGroup)
Definition BulkDataCookedIndex.h:89
static COREUOBJECT_API const FBulkDataCookedIndex Default
Definition BulkDataCookedIndex.h:42
FBulkDataCookedIndex(ValueType InValue)
Definition BulkDataCookedIndex.h:45
bool operator==(const FBulkDataCookedIndex &Other) const
Definition BulkDataCookedIndex.h:79
~FBulkDataCookedIndex()=default
static constexpr int32 MAX_DIGITS
Definition BulkDataCookedIndex.h:40
FBulkDataCookedIndex()=default
bool IsDefault() const
Definition BulkDataCookedIndex.h:53
static FBulkDataCookedIndex ParseFromPath(FStringView Path)
Definition BulkDataCookedIndex.h:100
static CORE_API bool IsSeparator(TCHAR c)
Definition PathViews.cpp:360
Definition StructuredArchiveSlots.h:52
bool IsNumericOnlyDigits(FWideStringView View)
Definition Numeric.cpp:87
U16 Index
Definition radfft.cpp:71
Definition NumericLimits.h:41