void UTextProperty::SerializeItem( FArchive& Ar, void* Value, int32 MaxReadBytes, void const* Defaults ) const { const TCppType PropertyValue = GetPropertyValue(Value); if ( Ar.IsSaving() && Ar.IsPersistent() && PropertyValue.IsTransient() ) { const FText ErrorMessage = FText::Format( FText::SerializationFailureError, FText::FromString( FTextInspector::GetDisplayString(PropertyValue) ) ); UE_LOG( LogProperty, Warning, TEXT("%s"), *ErrorMessage.ToString()); SetPropertyValue(Value, ErrorMessage); } Ar << *GetPropertyValuePtr(Value); }
const TCHAR* UTextProperty::ImportText_Internal( const TCHAR* Buffer, void* Data, int32 PortFlags, UObject* Parent, FOutputDevice* ErrorText ) const { FText* Text = GetPropertyValuePtr(Data); FString BufferAsString; if( !(PortFlags & PPF_Delimited) ) { BufferAsString = FString(Buffer); // in order to indicate that the value was successfully imported, advance the buffer past the last character that was imported Buffer += FCString::Strlen(Buffer); } else { // require quoted string here if (*Buffer != TCHAR('"')) { ErrorText->Logf(TEXT("Missing opening '\"' in string property value: %s"), Buffer); return NULL; } const TCHAR* Start = Buffer; FString Temp; Buffer = UPropertyHelpers::ReadToken(Buffer, Temp); if (Buffer == NULL) { return NULL; } if (Buffer > Start && Buffer[-1] != TCHAR('"')) { ErrorText->Logf(TEXT("Missing terminating '\"' in string property value: %s"), Start); return NULL; } BufferAsString = FString(Temp); } *Text = FText::FromString( FString(BufferAsString) ); return Buffer; }
const TCHAR* UTextProperty::ImportText_Internal( const TCHAR* Buffer, void* Data, int32 PortFlags, UObject* Parent, FOutputDevice* ErrorText ) const { FText* TextPtr = GetPropertyValuePtr(Data); FString PackageNamespace; #if USE_STABLE_LOCALIZATION_KEYS if (GIsEditor && !(PortFlags & PPF_DuplicateForPIE)) { PackageNamespace = TextNamespaceUtil::EnsurePackageNamespace(Parent); } #endif // USE_STABLE_LOCALIZATION_KEYS int32 NumCharsRead = 0; if (FTextStringHelper::ReadFromString(Buffer, *TextPtr, nullptr, *PackageNamespace, &NumCharsRead, !!(PortFlags & PPF_Delimited))) { Buffer += NumCharsRead; return Buffer; } return nullptr; }
void UDelegateProperty::SerializeItem( FArchive& Ar, void* Value, void const* Defaults ) const { Ar << *GetPropertyValuePtr(Value); }
void UTextProperty::SerializeItem( FArchive& Ar, void* Value, void const* Defaults ) const { const TCppType PropertyValue = GetPropertyValue(Value); Ar << *GetPropertyValuePtr(Value); }