X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=base%2Fdali-toolkit%2Finternal%2Fcontrols%2Ftable-view%2Ftable-view-impl.cpp;h=85099f53f959187e55ec2f8f84280a54169426ae;hb=ba3532286369da665dcf46d7c3260b178edb8b5b;hp=b6ff462a08885d441916ed68439d4dc29305c765;hpb=c67dcd03dc527baa8edcb6d4e8efcade2dde632b;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/base/dali-toolkit/internal/controls/table-view/table-view-impl.cpp b/base/dali-toolkit/internal/controls/table-view/table-view-impl.cpp index b6ff462..85099f5 100644 --- a/base/dali-toolkit/internal/controls/table-view/table-view-impl.cpp +++ b/base/dali-toolkit/internal/controls/table-view/table-view-impl.cpp @@ -17,15 +17,17 @@ // CLASS HEADER #include -#include // EXTERNAL INCLUDES -#include -#include #include +#include +#include +#include +#include +#include +#include using namespace Dali; -using namespace std; namespace { @@ -70,8 +72,8 @@ struct RelativeToWidthOrHeight // debugging support, very useful when new features are added or bugs are hunted down // currently not called from code so compiler will optimize these away, kept here for future debugging -#define TABLEVIEW_TAG "DALI Toolkit::TableView" -#define TV_LOG(fmt, args...) LOG(LOG_INFO, TABLEVIEW_TAG, fmt, ## args) +#define TABLEVIEW_TAG "DALI Toolkit::TableView " +#define TV_LOG(fmt, args...) Debug::LogMessage(Debug::DebugInfo, TABLEVIEW_TAG fmt, ## args) void PrintArray( Array2d& array ) { @@ -112,7 +114,7 @@ void PrintArray( Array2d& array ) } // debugging support, very useful when new features are added or bugs are hunted down // currently not called from code so compiler will optimize these away, kept here for future debugging -void PrintVector( vector& array ) +void PrintVector( std::vector& array ) { TV_LOG( "vector, size [%d]\n", array.size() ); // print values @@ -357,14 +359,14 @@ void TableView::InsertRow( unsigned int rowIndex ) void TableView::DeleteRow( unsigned int rowIndex ) { - vector< Actor > ignored; + std::vector< Actor > ignored; DeleteRow( rowIndex, ignored ); } -void TableView::DeleteRow( unsigned int rowIndex, vector& removed ) +void TableView::DeleteRow( unsigned int rowIndex, std::vector& removed ) { RelayoutingLock lock( *this ); - vector< CellData > lost; + std::vector< CellData > lost; mCellData.DeleteRow( rowIndex, lost ); // need to update the cellinfos for the items that moved const unsigned int rowCount = mCellData.GetRows(); @@ -444,14 +446,14 @@ void TableView::InsertColumn( unsigned int columnIndex ) void TableView::DeleteColumn( unsigned int columnIndex ) { - vector< Actor > ignored; + std::vector< Actor > ignored; DeleteColumn( columnIndex, ignored ); } -void TableView::DeleteColumn( unsigned int columnIndex, vector& removed ) +void TableView::DeleteColumn( unsigned int columnIndex, std::vector& removed ) { RelayoutingLock lock( *this ); - vector< CellData > lost; + std::vector< CellData > lost; mCellData.DeleteColumn( columnIndex, lost ); // need to update the cellinfos for the items that moved const unsigned int rowCount = mCellData.GetRows(); @@ -495,17 +497,17 @@ void TableView::DeleteColumn( unsigned int columnIndex, vector& removed ) void TableView::Resize( unsigned int rows, unsigned int columns ) { - vector< Actor > ignored; + std::vector< Actor > ignored; Resize( rows, columns, ignored ); } -void TableView::Resize( unsigned int rows, unsigned int columns, vector& removed ) +void TableView::Resize( unsigned int rows, unsigned int columns, std::vector& removed ) { RelayoutingLock lock( *this ); unsigned int oldRows = GetRows(); unsigned int oldColumns = GetColumns(); // resize data array - vector< CellData > lost; + std::vector< CellData > lost; ResizeContainers( rows, columns, lost ); // calculate if we lost rows or columns unsigned int rowsRemoved = 0; @@ -968,11 +970,11 @@ void TableView::OnInitialize() void TableView::ResizeContainers( unsigned int rows, unsigned int columns ) { - vector ignored; + std::vector ignored; ResizeContainers( rows, columns, ignored ); } -void TableView::ResizeContainers( unsigned int rows, unsigned int columns, vector& removed ) +void TableView::ResizeContainers( unsigned int rows, unsigned int columns, std::vector& removed ) { mCellData.Resize( rows, columns, removed ); // we dont care if these go smaller, data will be regenerated or is not needed anymore @@ -983,11 +985,11 @@ void TableView::ResizeContainers( unsigned int rows, unsigned int columns, vecto mRelativeWidths.resize( columns ); } -void TableView::RemoveAndGetLostActors( const vector& lost, vector& removed, +void TableView::RemoveAndGetLostActors( const std::vector& lost, std::vector& removed, unsigned int rowsRemoved, unsigned int columnsRemoved ) { // iterate through all lost cells - vector< CellData >::const_iterator iter = lost.begin(); + std::vector< CellData >::const_iterator iter = lost.begin(); for( ; iter != lost.end(); ++iter ) { // if it is a valid actor @@ -1158,16 +1160,17 @@ void TableView::SetHeightOrWidthProperty(TableView& tableViewImpl, if( Property::MAP == value.GetType() ) { Property::Map map = value.Get(); - unsigned int rowIndex; - for( Property::Map::const_iterator iter = map.begin(); iter != map.end(); iter++) + unsigned int rowIndex(0); + for ( unsigned int i = 0, count = map.Count(); i < count; ++i ) { - if( istringstream(iter->first) >> rowIndex // the key is a number - && Property::MAP == (iter->second).GetType()) + Property::Value& item = map.GetValue(i); + + if( std::istringstream(map.GetKey(i)) >> rowIndex // the key is a number + && Property::MAP == item.GetType()) { - Property::Value item = iter->second; if( item.HasKey( "policy" ) && item.HasKey( "value" ) ) { - Toolkit::TableView::LayoutPolicy policy = Scripting::GetEnumeration< Toolkit::TableView::LayoutPolicy >( item.GetValue("policy").Get(), LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT ); + Toolkit::TableView::LayoutPolicy policy = Scripting::GetEnumeration< Toolkit::TableView::LayoutPolicy >( item.GetValue("policy").Get(), LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT ); if( policy == Toolkit::TableView::Fixed ) { (tableViewImpl.*funcFixed)( rowIndex, item.GetValue("value").Get() ); @@ -1198,31 +1201,27 @@ Property::Value TableView::GetColumnWidthsPropertyValue() void TableView::GetMapPropertyValue( const std::vector& fixedSize, const std::vector& relativeSize, Property::Map& map ) { - string fixedPolicy( Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::Fixed, LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT ) ); - string relativePolicy( Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::Relative, LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT ) ); - Property::StringValuePair fixedPolicyPair( "policy", fixedPolicy ); - Property::StringValuePair relativePolicyPair( "policy", relativePolicy ); + std::string fixedPolicy( Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::Fixed, LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT ) ); + std::string relativePolicy( Scripting::GetEnumerationName< Toolkit::TableView::LayoutPolicy >( Toolkit::TableView::Relative, LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT ) ); size_t count = fixedSize.size(); for( size_t index = 0; index < count; index++ ) { if( ! EqualsZero( fixedSize[index] ) ) { - Property::StringValuePair valuePair( "value", fixedSize[index] ); Property::Map item; - item.push_back( fixedPolicyPair ); - item.push_back( valuePair ); + item[ "policy" ] = fixedPolicy; + item[ "value" ] = fixedSize[index]; - map.push_back( Property::StringValuePair( static_cast( &(std::ostringstream() << index ) )->str(), item ) ); + map[ static_cast( &(std::ostringstream() << index ) )->str() ] = item; } else if( ! EqualsZero( relativeSize[index] ) ) { - Property::StringValuePair valuePair( "value", relativeSize[index] ); Property::Map item; - item.push_back( relativePolicyPair ); - item.push_back( valuePair ); + item[ "policy" ] = relativePolicy; + item[ "value" ] = relativeSize[index]; - map.push_back( Property::StringValuePair( static_cast( &(std::ostringstream() << index ) )->str(), item ) ); + map[ static_cast( &(std::ostringstream() << index ) )->str() ] = item; } } }