ObjectProperty Entity::addProperty(const std::string& identifier, const Entity& object) { if (impl_.get()) { ObjectProperty property(identifier, *this, object); impl_->properties_.insert(std::make_pair(identifier, property)); return property; } else return ObjectProperty(); }
void FPropertyTableColumn::Sort( TArray< TSharedRef< class IPropertyTableRow > >& Rows, const EColumnSortMode::Type SortMode ) { if ( SortMode == EColumnSortMode::None ) { return; } TWeakObjectPtr< UObject > Object = DataSource->AsUObject(); UProperty* Property = Cast< UProperty >( Object.Get() ); TSharedPtr< FPropertyPath > Path = DataSource->AsPropertyPath(); if ( Property == NULL && Path.IsValid() ) { Property = Path->GetLeafMostProperty().Property.Get(); } if (!Property) { return; } if ( Property->IsA( UByteProperty::StaticClass() ) ) { TWeakObjectPtr<UByteProperty> ByteProperty( Cast< UByteProperty >( Property ) ); if ( SortMode == EColumnSortMode::Ascending ) { Rows.Sort( FCompareRowByColumnAscending< UByteProperty >( SharedThis( this ), ByteProperty ) ); } else { Rows.Sort( FCompareRowByColumnDescending< UByteProperty >( SharedThis( this ), ByteProperty ) ); } } else if ( Property->IsA( UIntProperty::StaticClass() ) ) { TWeakObjectPtr<UIntProperty> IntProperty( Cast< UIntProperty >( Property ) ); if ( SortMode == EColumnSortMode::Ascending ) { Rows.Sort( FCompareRowByColumnAscending< UIntProperty >( SharedThis( this ), IntProperty ) ); } else { Rows.Sort( FCompareRowByColumnDescending< UIntProperty >( SharedThis( this ), IntProperty ) ); } } else if ( Property->IsA( UBoolProperty::StaticClass() ) ) { TWeakObjectPtr<UBoolProperty> BoolProperty( Cast< UBoolProperty >( Property ) ); if ( SortMode == EColumnSortMode::Ascending ) { Rows.Sort( FCompareRowByColumnAscending< UBoolProperty >( SharedThis( this ), BoolProperty ) ); } else { Rows.Sort( FCompareRowByColumnDescending< UBoolProperty >( SharedThis( this ), BoolProperty ) ); } } else if ( Property->IsA( UFloatProperty::StaticClass() ) ) { TWeakObjectPtr<UFloatProperty> FloatProperty( Cast< UFloatProperty >( Property ) ); if ( SortMode == EColumnSortMode::Ascending ) { Rows.Sort( FCompareRowByColumnAscending< UFloatProperty >( SharedThis( this ), FloatProperty ) ); } else { Rows.Sort( FCompareRowByColumnDescending< UFloatProperty >( SharedThis( this ), FloatProperty ) ); } } else if ( Property->IsA( UNameProperty::StaticClass() ) ) { TWeakObjectPtr<UNameProperty> NameProperty( Cast< UNameProperty >( Property ) ); if ( SortMode == EColumnSortMode::Ascending ) { Rows.Sort( FCompareRowByColumnAscending< UNameProperty >( SharedThis( this ), NameProperty ) ); } else { Rows.Sort( FCompareRowByColumnDescending< UNameProperty >( SharedThis( this ), NameProperty ) ); } } else if ( Property->IsA( UStrProperty::StaticClass() ) ) { TWeakObjectPtr<UStrProperty> StrProperty( Cast< UStrProperty >( Property ) ); if ( SortMode == EColumnSortMode::Ascending ) { Rows.Sort( FCompareRowByColumnAscending< UStrProperty >( SharedThis( this ), StrProperty ) ); } else { Rows.Sort( FCompareRowByColumnDescending< UStrProperty >( SharedThis( this ), StrProperty ) ); } } else if ( Property->IsA( UObjectProperty::StaticClass() ) ) { TWeakObjectPtr<UObjectProperty> ObjectProperty( Cast< UObjectProperty >( Property ) ); if ( SortMode == EColumnSortMode::Ascending ) { Rows.Sort( FCompareRowByColumnAscending< UObjectProperty >( SharedThis( this ), ObjectProperty ) ); } else { Rows.Sort( FCompareRowByColumnDescending< UObjectProperty >( SharedThis( this ), ObjectProperty ) ); } } //else if ( Property->IsA( UTextProperty::StaticClass() ) ) //{ // if ( SortMode == EColumnSortMode::Ascending ) // { // Rows.Sort( FCompareRowByColumnAscending< UTextProperty >( SharedThis( this ) ) ); // } // else // { // Rows.Sort( FCompareRowByColumnDescending< UTextProperty >( SharedThis( this ) ) ); // } //} else { check( false && "Cannot Sort Rows by this Column!" ); } }