UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
StrProperty.cpp.inl
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*********************************************************************************************************************
4 * NOTICE *
5 * *
6 * This file is not intended to be included directly - it will be included by other .cpp files which have predefined *
7 * some macros to be expanded within this file. As such, it does not have a #pragma once as it is intended to be *
8 * included multiple times with different macro definitions. *
9 * *
10 * #includes needed to compile this file need to be specified in StringIncludes.cpp.inl file rather than here. *
11 *********************************************************************************************************************/
12#define UE_INCLUDETOOL_IGNORE_INCONSISTENT_STATE
13
14#ifndef UE_STRPROPERTY_CLASS
15 #error "StrProperty.cpp.inl should only be included after defining UE_STRPROPERTY_CLASS"
16#endif
17#ifndef UE_STRPROPERTY_STRINGTYPE
18 #error "StrProperty.cpp.inl should only be included after defining UE_STRPROPERTY_STRINGTYPE"
19#endif
20#ifndef UE_STRPROPERTY_CASTCLASSFLAG
21 #error "StrProperty.cpp.inl should only be included after defining UE_STRPROPERTY_CASTCLASSFLAG"
22#endif
23#ifndef UE_STRPROPERTY_PROPERTYPARAMSSTRUCT
24 #error "StrProperty.cpp.inl should only be included after defining UE_STRPROPERTY_PROPERTYPARAMSSTRUCT"
25#endif
26
28
33
34UE_STRPROPERTY_CLASS::UE_STRPROPERTY_CLASS(FFieldVariant InOwner, const UECodeGen_Private::UE_STRPROPERTY_PROPERTYPARAMSSTRUCT& Prop)
36{
37}
38
39#if WITH_EDITORONLY_DATA
40UE_STRPROPERTY_CLASS::UE_STRPROPERTY_CLASS(UField* InField)
41 : Super(InField)
42{
43}
44#endif // WITH_EDITORONLY_DATA
45
47{
48 if (GetClass()->GetFName() == Tag.Type)
49 {
51 }
52
53 // Convert serialized text to string.
54 if (Tag.Type==NAME_TextProperty)
55 {
56 FText Text;
57 Slot << Text;
59 SetPropertyValue_InContainer(Data, String, Tag.ArrayIndex);
60 }
61 else if (Tag.Type==NAME_StrProperty)
62 {
63 FString SavedStr;
64 Slot << SavedStr;
67 }
68 else if (Tag.Type==NAME_Utf8StrProperty)
69 {
71 Slot << SavedStr;
74 }
75 else if (Tag.Type==NAME_AnsiStrProperty)
76 {
78 Slot << SavedStr;
81 }
82 else
83 {
85 }
86
88}
89
90void UE_STRPROPERTY_CLASS::ExportText_Internal( FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope ) const
91{
92 UE_STRPROPERTY_STRINGTYPE StringValue;
94 {
96 }
97 else
98 {
100 }
101
102 if (!(PortFlags & PPF_Delimited))
103 {
104 ValueStr += StringValue;
105 }
106 else if ( StringValue.Len() > 0 )
107 {
108 ValueStr += UE_STRPROPERTY_STRINGTYPE::Printf( CHARTEXT(UE_STRPROPERTY_STRINGTYPE::FmtCharType, "\"%s\""), *StringValue.ReplaceCharWithEscapedChar() );
109 }
110 else
111 {
112 ValueStr += CHARTEXT(UE_STRPROPERTY_STRINGTYPE::ElementType, "\"\"");
113 }
114}
116{
118 if( !(PortFlags & PPF_Delimited) )
119 {
121
122 // in order to indicate that the value was successfully imported, advance the buffer past the last character that was imported
124 }
125 else
126 {
127 // require quoted string here
128 if (*Buffer != TCHAR('"'))
129 {
130 ErrorText->Logf(TEXT("Missing opening '\"' in string property value: %s"), Buffer);
131 return NULL;
132 }
133 const TCHAR* Start = Buffer;
134 FString Temp;
136 if (Buffer == NULL)
137 {
138 return NULL;
139 }
140 if (Buffer > Start && Buffer[-1] != TCHAR('"'))
141 {
142 ErrorText->Logf(TEXT("Missing terminating '\"' in string property value: %s"), Start);
143 return NULL;
144 }
146 }
148 {
150 }
151 else
152 {
154 }
155 return Buffer;
156}
157
159{
160 return GetTypeHash(*(const UE_STRPROPERTY_STRINGTYPE*)Src);
161}
#define NULL
Definition oodle2base.h:134
#define UE_STRPROPERTY_STRINGTYPE
Definition AnsiStrProperty.cpp:9
#define IMPLEMENT_FIELD(TClass)
Definition Field.h:330
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
#define CHARTEXT(CharType, x)
Definition Platform.h:1291
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
EObjectFlags
Definition ObjectMacros.h:552
@ PPF_Delimited
Definition PropertyPortFlags.h:18
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
EPropertyPointerType
Definition UnrealType.h:156
EConvertFromTypeResult
Definition UnrealType.h:130
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Field.h:353
Definition NameTypes.h:617
Definition OutputDevice.h:133
void Logf(const FmtType &Fmt)
Definition OutputDevice.h:234
static COREUOBJECT_API const TCHAR * ReadToken(const TCHAR *Buffer, FString &Out, bool DottedNames=false)
Definition Property.cpp:654
Definition StructuredArchiveSlots.h:52
static CORE_API const FString * GetSourceString(const FText &Text)
Definition Text.cpp:72
Definition Text.h:385
UE_FORCEINLINE_HINT void GetValue_InContainer(void const *InContainer, TCppType *OutValue) const
Definition UnrealType.h:1665
UE_FORCEINLINE_HINT void SetPropertyValue_InContainer(void *A, TCppType const &Value, int32 ArrayIndex=0) const
Definition UnrealType.h:1655
UE_FORCEINLINE_HINT void SetValue_InContainer(void *OutContainer, const TCppType &InValue) const
Definition UnrealType.h:1660
Definition StrProperty.h.inl:28
virtual COREUOBJECT_API const TCHAR * ImportText_Internal(const TCHAR *Buffer, void *ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject *OwnerObject, int32 PortFlags, FOutputDevice *ErrorText) const override
Definition StrProperty.cpp.inl:115
virtual COREUOBJECT_API void ExportText_Internal(FString &ValueStr, const void *PropertyValueOrContainer, EPropertyPointerType PropertyPointerType, const void *DefaultValue, UObject *Parent, int32 PortFlags, UObject *ExportRootScope) const override
Definition StrProperty.cpp.inl:90
COREUOBJECT_API uint32 GetValueTypeHashInternal(const void *Src) const override
Definition StrProperty.cpp.inl:158
virtual COREUOBJECT_API EConvertFromTypeResult ConvertFromType(const FPropertyTag &Tag, FStructuredArchive::FSlot Slot, uint8 *Data, const UStruct *DefaultsStruct, const uint8 *Defaults) override
Definition StrProperty.cpp.inl:46
COREUOBJECT_API UE_STRPROPERTY_CLASS(FFieldVariant InOwner, const FName &InName, EObjectFlags InObjectFlags)
Definition StrProperty.cpp.inl:29
Definition Class.h:181
Definition Object.h:95
Definition Class.h:480
Definition UObjectConstructInternal.h:15
Definition PropertyTag.h:38
static int32 Strlen(const CharType *String)
Definition CString.h:1047