From: Adeel Kazmi Date: Fri, 17 Oct 2014 17:58:47 +0000 (+0100) Subject: Updates after changes to Property::Map X-Git-Tag: dali_1.0.15~5 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=be0d47169c97f0a3100834d0c129032bdefce9c6 Updates after changes to Property::Map Change-Id: I4ba8dc81c84c681c5b2fc0b29a6fcebdf4f3ee27 --- diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp index c88aa92..ccfb863 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-PushButton.cpp @@ -679,7 +679,7 @@ int UtcDaliPushButtonProperties(void) DALI_TEST_EQUALS( "IMAGE_PATH_1", button.GetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION ); Property::Map map; - map.push_back( Property::StringValuePair( "type", "ImageActor" ) ); + map[ "type" ] = "ImageActor"; button.SetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR, map ); DALI_TEST_EQUALS( "ImageActor", button.GetProperty( PushButton::PROPERTY_NORMAL_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); @@ -691,7 +691,7 @@ int UtcDaliPushButtonProperties(void) DALI_TEST_EQUALS( "IMAGE_PATH_2", button.GetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION ); Property::Map map; - map.push_back( Property::StringValuePair( "type", "Actor" ) ); + map[ "type" ] = "Actor"; button.SetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR, map ); DALI_TEST_EQUALS( "Actor", button.GetProperty( PushButton::PROPERTY_PRESSED_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); @@ -704,7 +704,7 @@ int UtcDaliPushButtonProperties(void) DALI_TEST_EQUALS( "IMAGE_PATH_3", button.GetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR ).GetValue( "image" ).GetValue( "filename" ).Get< std::string >(), TEST_LOCATION ); Property::Map map; - map.push_back( Property::StringValuePair( "type", "Actor" ) ); + map[ "type" ] = "Actor"; button.SetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR, map ); DALI_TEST_EQUALS( "Actor", button.GetProperty( PushButton::PROPERTY_DIMMED_STATE_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); @@ -716,7 +716,7 @@ int UtcDaliPushButtonProperties(void) DALI_TEST_EQUALS( "TextView", button.GetProperty( PushButton::PROPERTY_LABEL_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); Property::Map map; - map.push_back( Property::StringValuePair( "type", "Actor" ) ); + map[ "type" ] = "Actor"; button.SetProperty( PushButton::PROPERTY_LABEL_ACTOR, map ); DALI_TEST_EQUALS( "Actor", button.GetProperty( PushButton::PROPERTY_LABEL_ACTOR ).GetValue( "type" ).Get< std::string >(), TEST_LOCATION ); diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-TableView.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-TableView.cpp index a50ffc9..fe75b1d 100644 --- a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-TableView.cpp +++ b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-TableView.cpp @@ -595,12 +595,12 @@ int UtcDaliTableViewSetGetProperty(void) //{ "policy": "fixed", "value": 30.0 }, Property::Map item1; - item1.push_back( Property::StringValuePair( "policy", "fixed" ) ); - item1.push_back( Property::StringValuePair( "value", 30.f) ); + item1[ "policy" ] = "fixed"; + item1[ "value" ] = 30.f; //{ "policy": "relative", "value": 0.2 }, Property::Map item2; - item2.push_back( Property::StringValuePair( "policy", "relative" ) ); - item2.push_back( Property::StringValuePair( "value", 0.2f ) ); + item2[ "policy" ] = "relative"; + item2[ "value" ] = 0.2f; // Test "layout-rows" property DALI_TEST_CHECK( tableView.GetPropertyIndex(PROPERTY_NAME_LAYOUT_ROWS) == TableView::PROPERTY_LAYOUT_ROWS ); @@ -613,20 +613,20 @@ int UtcDaliTableViewSetGetProperty(void) * } */ Property::Map layoutRows; - layoutRows.push_back( Property::StringValuePair("1", item1) ); - layoutRows.push_back( Property::StringValuePair("3", item2) ); + layoutRows[ "1" ] = item1; + layoutRows[ "3" ] = item2; tableView.SetProperty( TableView::PROPERTY_LAYOUT_ROWS, layoutRows ); DALI_TEST_EQUALS( tableView.GetFixedHeight( 1u ), 30.f, TEST_LOCATION ); DALI_TEST_EQUALS( tableView.GetRelativeHeight( 3u ), 0.2f, TEST_LOCATION ); Property::Map layoutRowsGet = tableView.GetProperty(TableView::PROPERTY_LAYOUT_ROWS).Get(); - DALI_TEST_CHECK( layoutRowsGet[0].first.compare(layoutRows[0].first) == 0 ); - DALI_TEST_CHECK( layoutRowsGet[0].second.GetValue( "policy" ).Get().compare(layoutRows[0].second.GetValue( "policy" ).Get()) == 0 ); - DALI_TEST_EQUALS( layoutRowsGet[0].second.GetValue( "value" ).Get(),layoutRows[0].second.GetValue( "value" ).Get(), TEST_LOCATION ); - DALI_TEST_CHECK( layoutRowsGet[1].first.compare(layoutRows[1].first) == 0 ); - DALI_TEST_CHECK( layoutRowsGet[1].second.GetValue( "policy" ).Get().compare(layoutRows[1].second.GetValue( "policy" ).Get()) == 0 ); - DALI_TEST_EQUALS( layoutRowsGet[1].second.GetValue( "value" ).Get(),layoutRows[1].second.GetValue( "value" ).Get(), TEST_LOCATION ); + DALI_TEST_CHECK( layoutRowsGet.GetKey(0).compare(layoutRows.GetKey(0)) == 0 ); + DALI_TEST_CHECK( layoutRowsGet.GetValue(0).GetValue( "policy" ).Get().compare(layoutRows.GetValue(0).GetValue( "policy" ).Get()) == 0 ); + DALI_TEST_EQUALS( layoutRowsGet.GetValue(0).GetValue( "value" ).Get(),layoutRows.GetValue(0).GetValue( "value" ).Get(), TEST_LOCATION ); + DALI_TEST_CHECK( layoutRowsGet.GetKey(1).compare(layoutRows.GetKey(1)) == 0 ); + DALI_TEST_CHECK( layoutRowsGet.GetValue(1).GetValue( "policy" ).Get().compare(layoutRows.GetValue(1).GetValue( "policy" ).Get()) == 0 ); + DALI_TEST_EQUALS( layoutRowsGet.GetValue(1).GetValue( "value" ).Get(),layoutRows.GetValue(1).GetValue( "value" ).Get(), TEST_LOCATION ); // Test "layout-columns" property DALI_TEST_CHECK( tableView.GetPropertyIndex( PROPERTY_NAME_LAYOUT_COLUMNS ) == TableView::PROPERTY_LAYOUT_COLUMNS ); @@ -639,20 +639,20 @@ int UtcDaliTableViewSetGetProperty(void) * } */ Property::Map layoutColumns; - layoutColumns.push_back( Property::StringValuePair("2", item2) ); - layoutColumns.push_back( Property::StringValuePair("3", item1) ); + layoutColumns[ "2" ] = item2; + layoutColumns[ "3" ] = item1; tableView.SetProperty( TableView::PROPERTY_LAYOUT_COLUMNS, layoutColumns ); DALI_TEST_EQUALS( tableView.GetRelativeWidth( 2u ), 0.2f, TEST_LOCATION ); DALI_TEST_EQUALS( tableView.GetFixedWidth( 3u ), 30.f, TEST_LOCATION ); Property::Map layoutColumnsGet = tableView.GetProperty(TableView::PROPERTY_LAYOUT_COLUMNS).Get(); - DALI_TEST_CHECK( layoutColumnsGet[0].first.compare(layoutColumns[0].first) == 0 ); - DALI_TEST_CHECK( layoutColumnsGet[0].second.GetValue( "policy" ).Get().compare(layoutColumns[0].second.GetValue( "policy" ).Get()) == 0 ); - DALI_TEST_EQUALS( layoutColumnsGet[0].second.GetValue( "value" ).Get(),layoutColumns[0].second.GetValue( "value" ).Get(), TEST_LOCATION ); - DALI_TEST_CHECK( layoutColumnsGet[1].first.compare(layoutColumns[1].first) == 0 ); - DALI_TEST_CHECK( layoutColumnsGet[1].second.GetValue( "policy" ).Get().compare(layoutColumns[1].second.GetValue( "policy" ).Get()) == 0 ); - DALI_TEST_EQUALS( layoutColumnsGet[1].second.GetValue( "value" ).Get(),layoutColumns[1].second.GetValue( "value" ).Get(), TEST_LOCATION ); + DALI_TEST_CHECK( layoutColumnsGet.GetKey(0).compare(layoutColumns.GetKey(0)) == 0 ); + DALI_TEST_CHECK( layoutColumnsGet.GetValue(0).GetValue( "policy" ).Get().compare(layoutColumns.GetValue(0).GetValue( "policy" ).Get()) == 0 ); + DALI_TEST_EQUALS( layoutColumnsGet.GetValue(0).GetValue( "value" ).Get(),layoutColumns.GetValue(0).GetValue( "value" ).Get(), TEST_LOCATION ); + DALI_TEST_CHECK( layoutColumnsGet.GetKey(1).compare(layoutColumns.GetKey(1)) == 0 ); + DALI_TEST_CHECK( layoutColumnsGet.GetValue(1).GetValue( "policy" ).Get().compare(layoutColumns.GetValue(1).GetValue( "policy" ).Get()) == 0 ); + DALI_TEST_EQUALS( layoutColumnsGet.GetValue(1).GetValue( "value" ).Get(),layoutColumns.GetValue(1).GetValue( "value" ).Get(), TEST_LOCATION ); END_TEST; } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp index 5cc1e0e..f1d1e16 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Control.cpp @@ -414,7 +414,7 @@ int UtcDaliControlBackgroundProperties(void) DALI_TEST_CHECK( !control.GetBackgroundActor() ); DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION ); DALI_TEST_EQUALS( control.GetProperty( Control::PROPERTY_BACKGROUND_COLOR ).Get< Vector4 >(), Color::TRANSPARENT, TEST_LOCATION ); - DALI_TEST_CHECK( control.GetProperty( Control::PROPERTY_BACKGROUND ).Get< Property::Map >().empty() ); + DALI_TEST_CHECK( !control.GetProperty( Control::PROPERTY_BACKGROUND ).Get< Property::Map >().Count() ); control.SetProperty( Control::PROPERTY_BACKGROUND_COLOR, Color::RED ); DALI_TEST_CHECK( control.GetBackgroundActor() ); @@ -422,9 +422,9 @@ int UtcDaliControlBackgroundProperties(void) DALI_TEST_EQUALS( control.GetProperty( Control::PROPERTY_BACKGROUND_COLOR ).Get< Vector4 >(), Color::RED, TEST_LOCATION ); Property::Map imageMap; - imageMap.push_back( Property::StringValuePair( "filename", "TestImage" ) ); + imageMap[ "filename" ] = "TestImage"; Property::Map map; - map.push_back( Property::StringValuePair( "image", imageMap ) ); + map[ "image" ] = imageMap; control.SetProperty( Control::PROPERTY_BACKGROUND, map ); DALI_TEST_CHECK( control.GetBackgroundActor() ); DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::RED, TEST_LOCATION ); @@ -440,7 +440,7 @@ int UtcDaliControlBackgroundProperties(void) DALI_TEST_CHECK( !control.GetBackgroundActor() ); DALI_TEST_EQUALS( control.GetBackgroundColor(), Color::TRANSPARENT, TEST_LOCATION ); DALI_TEST_EQUALS( control.GetProperty( Control::PROPERTY_BACKGROUND_COLOR ).Get< Vector4 >(), Color::TRANSPARENT, TEST_LOCATION ); - DALI_TEST_CHECK( control.GetProperty( Control::PROPERTY_BACKGROUND ).Get< Property::Map >().empty() ); + DALI_TEST_CHECK( !control.GetProperty( Control::PROPERTY_BACKGROUND ).Get< Property::Map >().Count() ); END_TEST; } diff --git a/base/dali-toolkit/internal/builder/builder-impl.cpp b/base/dali-toolkit/internal/builder/builder-impl.cpp index 3f134b6..ab62c75 100644 --- a/base/dali-toolkit/internal/builder/builder-impl.cpp +++ b/base/dali-toolkit/internal/builder/builder-impl.cpp @@ -167,7 +167,7 @@ std::string PropertyValueToString( const Property::Value& value ) } case Property::MAP: { - ret = std::string("Map Size=") + ToString( value.Get().size() ); + ret = std::string("Map Size=") + ToString( value.Get().Count() ); break; } case Property::TYPE_COUNT: 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 7a60aa6..ef2935d 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 @@ -1160,13 +1160,14 @@ 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( 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 ); @@ -1212,19 +1213,19 @@ void TableView::GetMapPropertyValue( const std::vector& fixedSize, const { Property::StringValuePair valuePair( "value", fixedSize[index] ); Property::Map item; - item.push_back( fixedPolicyPair ); - item.push_back( valuePair ); + item[ fixedPolicyPair.first ] = fixedPolicyPair.second; + item[ valuePair.first ] = valuePair.second; - 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[ relativePolicyPair.first ] = relativePolicyPair.second; + item[ valuePair.first ] = valuePair.second; - map.push_back( Property::StringValuePair( static_cast( &(std::ostringstream() << index ) )->str(), item ) ); + map[ static_cast( &(std::ostringstream() << index ) )->str() ] = item; } } } diff --git a/base/dali-toolkit/public-api/controls/control-impl.cpp b/base/dali-toolkit/public-api/controls/control-impl.cpp index c7b03dc..de46873 100644 --- a/base/dali-toolkit/public-api/controls/control-impl.cpp +++ b/base/dali-toolkit/public-api/controls/control-impl.cpp @@ -336,7 +336,7 @@ public: controlImpl.SetBackground( image ); } } - else if ( value.Get< Property::Map >().empty() ) + else if ( ! value.Get< Property::Map >().Count() ) { // An empty map means the background is no longer required controlImpl.ClearBackground(); @@ -421,7 +421,7 @@ public: Image image = imageActor.GetImage(); Property::Map imageMap; Scripting::CreatePropertyMap( image, imageMap ); - map.push_back( Property::StringValuePair( "image", imageMap ) ); + map[ "image" ] = imageMap; } } diff --git a/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h b/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h index 372e3c3..1b835e3 100755 --- a/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h +++ b/base/dali-toolkit/public-api/controls/scroll-bar/scroll-bar.h @@ -18,8 +18,11 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES #include +#include + +// INTERNAL INCLUDES #include namespace Dali DALI_IMPORT_API diff --git a/base/dali-toolkit/public-api/controls/scrollable/item-view/album-layout.h b/base/dali-toolkit/public-api/controls/scrollable/item-view/album-layout.h index b8133ed..f4e6eb5 100755 --- a/base/dali-toolkit/public-api/controls/scrollable/item-view/album-layout.h +++ b/base/dali-toolkit/public-api/controls/scrollable/item-view/album-layout.h @@ -26,9 +26,9 @@ Note:This layout is customized for music player application, so there are some l // EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES -#include #include namespace Dali DALI_IMPORT_API diff --git a/base/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h b/base/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h index 72f54e6..e695726 100644 --- a/base/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h +++ b/base/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h @@ -18,8 +18,11 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES #include +#include + +// INTERNAL INCLUDES #include #include diff --git a/base/dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h b/base/dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h index ef38209..e4ae17a 100644 --- a/base/dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h +++ b/base/dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h @@ -20,7 +20,8 @@ // EXTERNAL INCLUDES #include // std::pair -#include +#include +#include namespace Dali DALI_IMPORT_API { diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h index c4dca02..62fa417 100644 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h +++ b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h @@ -18,8 +18,9 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES #include +#include namespace Dali DALI_IMPORT_API { diff --git a/base/dali-toolkit/public-api/controls/table-view/table-view.h b/base/dali-toolkit/public-api/controls/table-view/table-view.h index 9051045..b5cad9f 100644 --- a/base/dali-toolkit/public-api/controls/table-view/table-view.h +++ b/base/dali-toolkit/public-api/controls/table-view/table-view.h @@ -18,8 +18,10 @@ * */ +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES -#include #include namespace Dali DALI_IMPORT_API diff --git a/base/dali-toolkit/public-api/markup-processor/markup-processor.h b/base/dali-toolkit/public-api/markup-processor/markup-processor.h index e162620..5400599 100644 --- a/base/dali-toolkit/public-api/markup-processor/markup-processor.h +++ b/base/dali-toolkit/public-api/markup-processor/markup-processor.h @@ -18,9 +18,8 @@ * */ -// INTERNAL INCLUDES +// EXTERNAL INCLUDES #include - #include #include diff --git a/optional/dali-toolkit/public-api/controls/navigation-frame/page.h b/optional/dali-toolkit/public-api/controls/navigation-frame/page.h index af0f17d..1032a2e 100644 --- a/optional/dali-toolkit/public-api/controls/navigation-frame/page.h +++ b/optional/dali-toolkit/public-api/controls/navigation-frame/page.h @@ -18,6 +18,9 @@ * */ +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include #include