* Build value based on a FProperty */
| 426 | * Build value based on a FProperty |
| 427 | */ |
| 428 | void FLuaDebugValue::BuildFromUProperty(const FProperty *InProperty, void *ValuePtr) |
| 429 | { |
| 430 | // #lizard forgives |
| 431 | |
| 432 | if (!InProperty || !ValuePtr) |
| 433 | { |
| 434 | return; |
| 435 | } |
| 436 | |
| 437 | int32 PropertyType = GetPropertyType(InProperty); |
| 438 | switch (PropertyType) |
| 439 | { |
| 440 | case CPT_Int8: |
| 441 | case CPT_Int16: |
| 442 | case CPT_Int: |
| 443 | case CPT_Int64: |
| 444 | case CPT_Byte: |
| 445 | case CPT_UInt16: |
| 446 | case CPT_UInt32: |
| 447 | case CPT_UInt64: |
| 448 | { |
| 449 | FNumericProperty *NumericProperty = (FNumericProperty*)InProperty; |
| 450 | ReadableValue = FString::Printf(TEXT("%ld"), NumericProperty->GetUnsignedIntPropertyValue(ValuePtr)); |
| 451 | } |
| 452 | break; |
| 453 | case CPT_Float: |
| 454 | case CPT_Double: |
| 455 | { |
| 456 | FNumericProperty *NumericProperty = (FNumericProperty*)InProperty; |
| 457 | ReadableValue = FString::Printf(TEXT("%lf"), NumericProperty->GetFloatingPointPropertyValue(ValuePtr)); |
| 458 | } |
| 459 | break; |
| 460 | case CPT_Enum: |
| 461 | { |
| 462 | FEnumProperty *EnumProperty = (FEnumProperty*)InProperty; |
| 463 | int64 Value = EnumProperty->GetUnderlyingProperty()->GetSignedIntPropertyValue(ValuePtr); |
| 464 | ReadableValue = FString::Printf(TEXT("%s: %s"), *EnumProperty->GetCPPType(nullptr, 0), *EnumProperty->GetEnum()->GetNameStringByValue(Value)); |
| 465 | } |
| 466 | break; |
| 467 | case CPT_Bool: |
| 468 | { |
| 469 | FBoolProperty *BoolProperty = (FBoolProperty*)InProperty; |
| 470 | ReadableValue = BoolProperty->GetPropertyValue(ValuePtr) ? TEXT("true") : TEXT("false"); |
| 471 | } |
| 472 | break; |
| 473 | case CPT_ObjectReference: |
| 474 | { |
| 475 | FObjectProperty *ObjectProperty = (FObjectProperty*)InProperty; |
| 476 | //UObject *Object = ObjectProperty->GetPropertyValue(ValuePtr); |
| 477 | //LuaValue->ReadableValue = FString::Printf(TEXT("%s: %p"), *ObjectProperty->GetCPPType(nullptr, 0), Object); |
| 478 | //if (Object && !ObjectProperty->PropertyClass->IsChildOf(UClass::StaticClass())) |
| 479 | //{ |
| 480 | // GetUStructValue(Object->GetClass(), Object, LuaValue); |
| 481 | //} |
| 482 | if (ObjectProperty->PropertyClass->IsChildOf(UClass::StaticClass())) |
| 483 | { |
| 484 | // UClass |
| 485 | FClassProperty *ClassProperty = (FClassProperty*)ObjectProperty; |
no test coverage detected