UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LocalizedTextSourceTypes.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"
7#include "Misc/UEOps.h"
11
12#include <type_traits>
13
19{
20 Game,
21 Engine,
22 Editor,
23};
24
37
42{
44 None = 0,
45
47 Native = 1<<0,
48
50 Editor = 1<<1,
51
53 Game = 1<<2,
54
56 Engine = 1<<3,
57
59 Additional = 1<<4,
60
62 ForceLocalizedGame = 1<<5,
63
68 SkipExisting = 1<<6,
69};
71
76{
77 enum Enum
78 {
79 Lowest = -1000,
80 Low = -100,
81 Normal = 0,
82 High = 100,
83 Highest = 1000,
84 };
85};
86
88{
89
90class FRefCountedDisplayString : public TRefCountingMixin<FRefCountedDisplayString>
91{
92public:
94 : DisplayString(MoveTemp(InDisplayString))
95 {
96 }
97
99 {
100 return DisplayString;
101 }
102
103private:
104 FString DisplayString;
105};
106
110template <typename ObjectType>
112{
113 static_assert(TPointerIsConvertibleFromTo<ObjectType, const FString>::Value, "TDisplayStringPtrBase can only be constructed with FString types");
114
115public:
117
122
123 [[nodiscard]] explicit operator bool() const
124 {
125 return IsValid();
126 }
127
128 [[nodiscard]] bool IsValid() const
129 {
130 return DisplayStringPtr.IsValid();
131 }
132
133 [[nodiscard]] ObjectType& operator*() const
134 {
135 return GetDisplayString();
136 }
137
138 [[nodiscard]] ObjectType* operator->() const
139 {
140 return &GetDisplayString();
141 }
142
147
148 template <typename OtherObjectType>
150 {
151 return DisplayStringPtr == Rhs.DisplayStringPtr;
152 }
153
154protected:
155 [[nodiscard]] FString& GetDisplayString() const
156 {
157 check(IsValid());
158 return DisplayStringPtr.GetReference()->Private_GetDisplayString();
159 }
160
162};
163
167template <typename ObjectType>
168class TDisplayStringRef : public TDisplayStringPtrBase<ObjectType>
169{
170public:
171 TDisplayStringRef() = default;
172
178
179 template <
180 typename OtherType
181 UE_REQUIRES(std::is_convertible_v<OtherType*, ObjectType*>)
182 >
187
188 template <
189 typename OtherType
190 UE_REQUIRES(std::is_convertible_v<OtherType*, ObjectType*>)
191 >
193 {
194 if (this->DisplayStringPtr != InOther.Private_GetDisplayStringPtr())
195 {
197 }
198 return *this;
199 }
200
201 [[nodiscard]] ObjectType& Get() const
202 {
203 return this->GetDisplayString();
204 }
205};
206
210template <typename ObjectType>
211class TDisplayStringPtr : public TDisplayStringPtrBase<ObjectType>
212{
213public:
214 TDisplayStringPtr() = default;
215
220
225
226 template <
227 typename OtherType
228 UE_REQUIRES(std::is_convertible_v<OtherType*, ObjectType*>)
229 >
234
235 template <
236 typename OtherType
237 UE_REQUIRES(std::is_convertible_v<OtherType*, ObjectType*>)
238 >
243
244 template <
245 typename OtherType
246 UE_REQUIRES(std::is_convertible_v<OtherType*, ObjectType*>)
247 >
249 {
250 if (this->DisplayStringPtr != InOther.Private_GetDisplayStringPtr())
251 {
253 }
254 return *this;
255 }
256
257 template <
258 typename OtherType
259 UE_REQUIRES(std::is_convertible_v<OtherType*, ObjectType*>)
260 >
262 {
263 if (this->DisplayStringPtr != InOther.Private_GetDisplayStringPtr())
264 {
266 }
267 return *this;
268 }
269
270 [[nodiscard]] ObjectType* Get() const
271 {
272 return this->IsValid()
273 ? &this->GetDisplayString()
274 : nullptr;
275 }
276
281
287};
288
289} // namespace UE::Text::Private
290
291template <typename ObjectType>
293{
294 return ::PointerHash(&A.Get());
295}
296
297template <typename ObjectType>
299{
300 return ::PointerHash(A.Get());
301}
302
307
#define check(expr)
Definition AssertionMacros.h:314
FPlatformTypes::TYPE_OF_NULLPTR TYPE_OF_NULLPTR
The type of the C++ nullptr keyword.
Definition Platform.h:1157
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
ELocalizedTextSourceCategory
Definition LocalizedTextSourceTypes.h:19
EQueryLocalizedResourceResult
Definition LocalizedTextSourceTypes.h:29
UE::Text::Private::TDisplayStringRef< FString > FTextDisplayStringRef
Definition LocalizedTextSourceTypes.h:303
ELocalizationLoadFlags
Definition LocalizedTextSourceTypes.h:42
FTextDisplayStringRef MakeTextDisplayString(FString &&InDisplayString)
Definition LocalizedTextSourceTypes.h:308
uint32 GetTypeHash(const UE::Text::Private::TDisplayStringRef< ObjectType > &A)
Definition LocalizedTextSourceTypes.h:292
const bool
Definition NetworkReplayStreaming.h:178
#define UE_REQUIRES(...)
Definition Requires.h:86
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Engine.Build.cs:7
Definition RefCounting.h:454
Definition RefCounting.h:355
Definition LocalizedTextSourceTypes.h:91
FString & Private_GetDisplayString()
Definition LocalizedTextSourceTypes.h:98
FRefCountedDisplayString(FString &&InDisplayString)
Definition LocalizedTextSourceTypes.h:93
Definition LocalizedTextSourceTypes.h:112
bool IsValid() const
Definition LocalizedTextSourceTypes.h:128
ObjectType & operator*() const
Definition LocalizedTextSourceTypes.h:133
TRefCountPtr< FRefCountedDisplayString > DisplayStringPtr
Definition LocalizedTextSourceTypes.h:161
FString & GetDisplayString() const
Definition LocalizedTextSourceTypes.h:155
ObjectType * operator->() const
Definition LocalizedTextSourceTypes.h:138
const TRefCountPtr< FRefCountedDisplayString > & Private_GetDisplayStringPtr() const
Definition LocalizedTextSourceTypes.h:143
bool UEOpEquals(const TDisplayStringPtrBase< OtherObjectType > &Rhs) const
Definition LocalizedTextSourceTypes.h:149
TDisplayStringPtrBase(const TRefCountPtr< FRefCountedDisplayString > &InDisplayStringPtr)
Definition LocalizedTextSourceTypes.h:118
Definition LocalizedTextSourceTypes.h:212
TDisplayStringPtr(const TDisplayStringRef< OtherType > &InOther)
Definition LocalizedTextSourceTypes.h:239
void Reset()
Definition LocalizedTextSourceTypes.h:277
TDisplayStringPtr & operator=(const TDisplayStringRef< OtherType > &InOther)
Definition LocalizedTextSourceTypes.h:261
ObjectType * Get() const
Definition LocalizedTextSourceTypes.h:270
TDisplayStringPtr(const TDisplayStringPtr< OtherType > &InOther)
Definition LocalizedTextSourceTypes.h:230
TDisplayStringRef< ObjectType > ToSharedRef() const
Definition LocalizedTextSourceTypes.h:282
TDisplayStringPtr & operator=(const TDisplayStringPtr< OtherType > &InOther)
Definition LocalizedTextSourceTypes.h:248
TDisplayStringPtr(TYPE_OF_NULLPTR)
Definition LocalizedTextSourceTypes.h:216
TDisplayStringPtr(const TRefCountPtr< FRefCountedDisplayString > &InDisplayStringPtr)
Definition LocalizedTextSourceTypes.h:221
Definition LocalizedTextSourceTypes.h:169
TDisplayStringRef(const TRefCountPtr< FRefCountedDisplayString > &InDisplayStringPtr)
Definition LocalizedTextSourceTypes.h:173
TDisplayStringRef(const TDisplayStringRef< OtherType > &InOther)
Definition LocalizedTextSourceTypes.h:183
TDisplayStringRef & operator=(const TDisplayStringRef< OtherType > &InOther)
Definition LocalizedTextSourceTypes.h:192
ObjectType & Get() const
Definition LocalizedTextSourceTypes.h:201
Definition LocalizedTextSourceTypes.h:88
Definition LocalizedTextSourceTypes.h:76
Enum
Definition LocalizedTextSourceTypes.h:78
@ Highest
Definition LocalizedTextSourceTypes.h:83
@ Lowest
Definition LocalizedTextSourceTypes.h:79
@ High
Definition LocalizedTextSourceTypes.h:82
@ Normal
Definition LocalizedTextSourceTypes.h:81
@ Low
Definition LocalizedTextSourceTypes.h:80
Definition PointerIsConvertibleFromTo.h:60