FORCEINLINE bool FCompareUObjectByPropertyAscending<UByteProperty>::ComparePropertyValue( const uint8& LhsValue, const uint8& RhsValue ) const { // Bytes are trivially sorted numerically UEnum* PropertyEnum = Property->GetIntPropertyEnum(); if( PropertyEnum == NULL ) { return LhsValue < RhsValue; } else { // But Enums are sorted alphabetically based on the full enum entry name - must be sure that values are within Enum bounds! bool bLhsEnumValid = LhsValue < PropertyEnum->NumEnums(); bool bRhsEnumValid = RhsValue < PropertyEnum->NumEnums(); if(bLhsEnumValid && bRhsEnumValid) { FName LhsEnumName( PropertyEnum->GetEnum( LhsValue ) ); FName RhsEnumName( PropertyEnum->GetEnum( RhsValue ) ); return LhsEnumName.Compare( RhsEnumName ) < 0; } else if(bLhsEnumValid) { return true; } else if(bRhsEnumValid) { return false; } else { return LhsValue < RhsValue; } } }
FORCEINLINE bool FCompareRowByColumnAscending<UByteProperty>::ComparePropertyValue( const TSharedPtr< IPropertyHandle >& LhsPropertyHandle, const TSharedPtr< IPropertyHandle >& RhsPropertyHandle ) const { // Get the basic uint8 values uint8 LhsValue; LhsPropertyHandle->GetValue( LhsValue ); uint8 RhsValue; RhsPropertyHandle->GetValue( RhsValue ); // Bytes are trivially sorted numerically UEnum* PropertyEnum = Property->GetIntPropertyEnum(); if( PropertyEnum == NULL ) { return LhsValue < RhsValue; } else { // But Enums are sorted alphabetically based on the full enum entry name - must be sure that values are within Enum bounds! bool bLhsEnumValid = LhsValue < PropertyEnum->NumEnums(); bool bRhsEnumValid = RhsValue < PropertyEnum->NumEnums(); if(bLhsEnumValid && bRhsEnumValid) { FName LhsEnumName( PropertyEnum->GetEnum( LhsValue ) ); FName RhsEnumName( PropertyEnum->GetEnum( RhsValue ) ); return LhsEnumName.Compare( RhsEnumName ) < 0; } else if(bLhsEnumValid) { return true; } else if(bRhsEnumValid) { return false; } else { return LhsValue < RhsValue; } } }