Пример #1
0
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);
}
Пример #2
0
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;
}
Пример #3
0
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;
}
Пример #4
0
void UDelegateProperty::SerializeItem( FArchive& Ar, void* Value, void const* Defaults ) const
{
	Ar << *GetPropertyValuePtr(Value);
}
Пример #5
0
void UTextProperty::SerializeItem( FArchive& Ar, void* Value, void const* Defaults ) const
{
	const TCppType PropertyValue = GetPropertyValue(Value);
	Ar << *GetPropertyValuePtr(Value);
}