removing use of using namespace std;
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / table-view / table-view-impl.cpp
index b6ff462..85099f5 100644 (file)
 
 // CLASS HEADER
 #include <dali-toolkit/internal/controls/table-view/table-view-impl.h>
-#include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/object/ref-object.h>
-#include <dlog.h>
 #include <sstream>
+#include <dali/public-api/animation/constraint.h>
+#include <dali/public-api/animation/time-period.h>
+#include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/scripting/scripting.h>
+#include <dali/integration-api/debug.h>
 
 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<Dali::Toolkit::Internal::TableView::CellData>& array )
 {
@@ -112,7 +114,7 @@ void PrintArray( Array2d<Size>& 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<float>& array )
+void PrintVector( std::vector<float>& 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<Actor>& removed )
+void TableView::DeleteRow( unsigned int rowIndex, std::vector<Actor>& 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<Actor>& removed )
+void TableView::DeleteColumn( unsigned int columnIndex, std::vector<Actor>& 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<Actor>& 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<Actor>& removed )
+void TableView::Resize( unsigned int rows, unsigned int columns, std::vector<Actor>& 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<CellData> ignored;
+  std::vector<CellData> ignored;
   ResizeContainers( rows, columns, ignored );
 }
 
-void TableView::ResizeContainers( unsigned int rows, unsigned int columns, vector<CellData>& removed )
+void TableView::ResizeContainers( unsigned int rows, unsigned int columns, std::vector<CellData>& 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<CellData>& lost, vector<Actor>& removed,
+void TableView::RemoveAndGetLostActors( const std::vector<CellData>& lost, std::vector<Actor>& 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<Property::Map>();
-    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<string>(), LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT );
+          Toolkit::TableView::LayoutPolicy policy = Scripting::GetEnumeration< Toolkit::TableView::LayoutPolicy >( item.GetValue("policy").Get<std::string>(), LAYOUT_POLICY_STRING_TABLE, LAYOUT_POLICY_STRING_TABLE_COUNT );
           if( policy == Toolkit::TableView::Fixed )
           {
             (tableViewImpl.*funcFixed)( rowIndex, item.GetValue("value").Get<float>() );
@@ -1198,31 +1201,27 @@ Property::Value TableView::GetColumnWidthsPropertyValue()
 
 void TableView::GetMapPropertyValue( const std::vector<float>& fixedSize, const std::vector<float>& 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*>( &(std::ostringstream() << index ) )->str(), item ) );
+      map[ static_cast<std::ostringstream*>( &(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*>( &(std::ostringstream() << index ) )->str(), item ) );
+      map[ static_cast<std::ostringstream*>( &(std::ostringstream() << index ) )->str() ] = item;
     }
   }
 }