Clean up codes
authorJinhwan Kim <jh-21.kim@samsung.com>
Fri, 22 Mar 2013 10:16:14 +0000 (19:16 +0900)
committerJinhwan Kim <jh-21.kim@samsung.com>
Fri, 22 Mar 2013 10:16:14 +0000 (19:16 +0900)
Change-Id: I1484ef92b5f71c0a8274a192fc89db2d69cd30e6
Signed-off-by: Jinhwan Kim <jh-21.kim@samsung.com>
src/ui/controls/FUiCtrl_GroupedListViewImpl.cpp
src/ui/controls/FUiCtrl_ListViewImpl.cpp

index 2682380..b46b724 100644 (file)
  */
 
 #include <FBaseSysLog.h>
+#include <FApp_AppInfo.h>
 #include <FGrp_TextTextSimple.h>
-#include "FApp_AppInfo.h"
 #include "FUi_CoordinateSystemUtils.h"
 #include "FUi_Math.h"
 #include "FUi_ResourceManager.h"
 #include "FUi_UiBuilder.h"
 #include "FUiCtrl_FastScrollEvent.h"
 #include "FUiCtrl_FastScrollEventArg.h"
-#include "FUiCtrl_Label.h"
 #include "FUiCtrl_GroupedListViewImpl.h"
 #include "FUiCtrl_GroupedListViewItemProviderAdaptor.h"
+#include "FUiCtrl_Label.h"
 #include "FUiCtrl_ListItemEvent.h"
 #include "FUiCtrl_ListItemEventArg.h"
 #include "FUiCtrl_ListViewItem.h"
 #include "FUiCtrl_ScrollEvent.h"
 #include "FUiCtrl_ScrollEventArg.h"
 
-#ifdef MEMORY_LEAK_CHECK
-#include "mem_leak_check.h"
-#endif
-
 using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Runtime;
 using namespace Tizen::Graphics;
 using namespace Tizen::Graphics::_Text;
@@ -94,29 +89,17 @@ _GroupedListViewImpl::_GroupedListViewImpl(GroupedListView* pGroupedList, _Table
 
 _GroupedListViewImpl::~_GroupedListViewImpl()
 {
-       if (__pListItemEvent != null)
-       {
-               delete __pListItemEvent;
-               __pListItemEvent = null;
-       }
+       delete __pListItemEvent;
+       __pListItemEvent = null;
 
-       if (__pLinkEvent != null)
-       {
-               delete __pLinkEvent;
-               __pLinkEvent = null;
-       }
+       delete __pLinkEvent;
+       __pLinkEvent = null;
 
-       if (__pScrollEvent != null)
-       {
-               delete __pScrollEvent;
-               __pScrollEvent = null;
-       }
+       delete __pScrollEvent;
+       __pScrollEvent = null;
 
-       if (__pFastScrollEvent != null)
-       {
-               delete __pFastScrollEvent;
-               __pFastScrollEvent = null;
-       }
+       delete __pFastScrollEvent;
+       __pFastScrollEvent = null;
 
        if (__pEmptyBitmap != null)
        {
@@ -134,11 +117,8 @@ _GroupedListViewImpl::~_GroupedListViewImpl()
                __pEmptyText = null;
        }
 
-       if (__pTouchEventHandler != null)
-       {
-               delete __pTouchEventHandler;
-               __pTouchEventHandler = null;
-       }
+       delete __pTouchEventHandler;
+       __pTouchEventHandler = null;
 
        if (__pLongPressedGesture != null)
        {
@@ -521,7 +501,7 @@ _GroupedListViewImpl::ScrollToItem(int groupIndex, int itemIndex, ListScrollItem
        else
        {
                SysTryReturn(NID_UI_CTRL, false, E_OUT_OF_RANGE, E_OUT_OF_RANGE,
-                                       "[E_OUT_OF_RANGE] The specified itemAlignment is out of range.");
+                               "[E_OUT_OF_RANGE] The specified itemAlignment is out of range.");
        }
 
        SetLastResultReturn(r);
@@ -609,9 +589,8 @@ _GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, ListRefreshType
        int groupCount = GetCore().GetGroupCount();
        int itemCount = GetCore().GetItemCountAt(groupIndex);
 
-       if ((groupIndex < 0) || (groupIndex > groupCount) ||
-               (itemIndex < -1) || (itemIndex > itemCount) ||
-               ((type != LIST_REFRESH_TYPE_ITEM_ADD) && (itemIndex == itemCount)))
+       if ((groupIndex < 0) || (groupIndex > groupCount) || (itemIndex < -1) || (itemIndex > itemCount) ||
+                       ((type != LIST_REFRESH_TYPE_ITEM_ADD) && (itemIndex == itemCount)))
        {
                SysLogException(NID_UI_CTRL, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The index is out of range.");
                return E_OUT_OF_RANGE;
@@ -654,9 +633,9 @@ _GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, ListRefreshType
                GetCore().GetFirstLoadedItemIndex(topGroupIndex, topItemIndex);
                GetCore().GetLastLoadedItemIndex(bottomGroupIndex, bottomItemIndex);
 
-               if ((topGroupIndex > groupIndex) || (bottomGroupIndex < groupIndex)
-                       || ((topGroupIndex == groupIndex) && (topItemIndex > itemIndex))
-                       || ((bottomGroupIndex == groupIndex) && (bottomItemIndex < itemIndex)))
+               if ((topGroupIndex > groupIndex) || (bottomGroupIndex < groupIndex) ||
+                               ((topGroupIndex == groupIndex) && (topItemIndex > itemIndex)) ||
+                               ((bottomGroupIndex == groupIndex) && (bottomItemIndex < itemIndex)))
                {
                        // not yet loaded item
                        SetLastResultReturn(r);
@@ -672,14 +651,10 @@ _GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, ListRefreshType
                                itemDrawingStatus = pListViewItem->GetDrawingStatus();
                                itemSelected = pListViewItem->GetSelectionState();
                                touchPosition = pListViewItem->GetLastTouchPressedPositionF();
-
-                               pListViewItem = null;
                        }
 
                        GetCore().UnloadItem(groupIndex, itemIndex);
-                       GetCore().LoadItem(groupIndex, itemIndex);
-
-                       pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
+                       pListViewItem = static_cast<_ListViewItem*>(GetCore().LoadItem(groupIndex, itemIndex));
 
                        if ((pListViewItem != null) && (itemDrawingStatus != TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL))
                        {
@@ -1236,7 +1211,7 @@ _GroupedListViewImpl::OnGroupedTableViewItemReordered(_TableView& tableView, int
        if (__pListItemEvent != null)
        {
                _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndexFrom, itemIndexFrom, groupIndexTo, itemIndexTo,
-                                                                                                                                          NOTIFY_TYPE_REORDERED_ITEM);
+                               NOTIFY_TYPE_REORDERED_ITEM);
                __pListItemEvent->Fire(*pArg);
        }
 }
@@ -1291,8 +1266,7 @@ _GroupedListViewImpl::FireListViewItemEvent(int groupIndex, int itemIndex, _Tabl
                        if ((__pLinkEvent != null) && (itemInfo.pUiLinkInfo != null))
                        {
                                IEventArg* pLinkEventArg = _PublicLinkEvent::CreateLinkEventArgN(itemInfo.pUiLinkInfo->textInfo,
-                                                                                                                                                                itemInfo.pUiLinkInfo->linkType,
-                                                                                                                                                                itemInfo.pUiLinkInfo->linkInfo);
+                                               itemInfo.pUiLinkInfo->linkType, itemInfo.pUiLinkInfo->linkInfo);
                                SysTryReturnVoidResult(NID_UI_CTRL, (pLinkEventArg != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create _LinkEventArg.");
                                __pLinkEvent->Fire(*pLinkEventArg);
 
@@ -1300,7 +1274,7 @@ _GroupedListViewImpl::FireListViewItemEvent(int groupIndex, int itemIndex, _Tabl
                        else
                        {
                                _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, itemInfo.elementId, 0,
-                                                                                                                                                          static_cast<NotifyType>(status));
+                                               static_cast<NotifyType>(status));
                                __pListItemEvent->Fire(*pArg);
                        }
 
@@ -1377,7 +1351,7 @@ _GroupedListViewImpl::OnDraw(void)
 }
 
 result
-_GroupedListViewImpl::OnBoundsChanging(const Tizen::Graphics::FloatRectangle& bounds)
+_GroupedListViewImpl::OnBoundsChanging(const FloatRectangle& bounds)
 {
        if (GetCore().GetBoundsF().width != bounds.width)
        {
@@ -1490,11 +1464,8 @@ _GroupedListViewImpl::OnFontInfoRequested(unsigned long& style, int& size)
 void
 _GroupedListViewImpl::OnFontInfoRequested(unsigned long& style, float& size)
 {
-       float textSize = 0;
-       GET_SHAPE_CONFIG(LISTVIEW::EMPTY_LIST_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, textSize);
-
+       GET_SHAPE_CONFIG(LISTVIEW::EMPTY_LIST_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, size);
        style = FONT_STYLE_PLAIN;
-       size = textSize;
 }
 
 bool
@@ -1792,4 +1763,3 @@ _GroupedListViewRegister::~_GroupedListViewRegister()
 }
 static _GroupedListViewRegister GroupedListViewRegisterToUIbuilder;
 }}} // Tizen::Ui::Controls
-
index 5386cc8..cda210f 100644 (file)
@@ -23,8 +23,8 @@
  */
 
 #include <FBaseSysLog.h>
+#include <FApp_AppInfo.h>
 #include <FGrp_TextTextSimple.h>
-#include "FApp_AppInfo.h"
 #include "FUi_CoordinateSystemUtils.h"
 #include "FUi_Math.h"
 #include "FUi_ResourceManager.h"
 #include "FUiCtrl_ScrollEvent.h"
 #include "FUiCtrl_ScrollEventArg.h"
 
-#ifdef MEMORY_LEAK_CHECK
-#include "mem_leak_check.h"
-#endif
-
 using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Runtime;
 using namespace Tizen::Graphics;
 using namespace Tizen::Graphics::_Text;
@@ -92,29 +87,17 @@ _ListViewImpl::_ListViewImpl(ListView* pList, _TableView* pCore)
 
 _ListViewImpl::~_ListViewImpl()
 {
-       if (__pListItemEvent != null)
-       {
-               delete __pListItemEvent;
-               __pListItemEvent = null;
-       }
+       delete __pListItemEvent;
+       __pListItemEvent = null;
 
-       if (__pLinkEvent != null)
-       {
-               delete __pLinkEvent;
-               __pLinkEvent = null;
-       }
+       delete __pLinkEvent;
+       __pLinkEvent = null;
 
-       if (__pScrollEvent != null)
-       {
-               delete __pScrollEvent;
-               __pScrollEvent = null;
-       }
+       delete __pScrollEvent;
+       __pScrollEvent = null;
 
-       if (__pFastScrollEvent != null)
-       {
-               delete __pFastScrollEvent;
-               __pFastScrollEvent = null;
-       }
+       delete __pFastScrollEvent;
+       __pFastScrollEvent = null;
 
        if (__pEmptyBitmap != null)
        {
@@ -132,11 +115,8 @@ _ListViewImpl::~_ListViewImpl()
                __pEmptyText = null;
        }
 
-       if (__pTouchEventHandler != null)
-       {
-               delete __pTouchEventHandler;
-               __pTouchEventHandler = null;
-       }
+       delete __pTouchEventHandler;
+       __pTouchEventHandler = null;
 
        if (__pLongPressedGesture != null)
        {
@@ -151,7 +131,7 @@ _ListViewImpl::~_ListViewImpl()
 const char*
 _ListViewImpl::GetPublicClassName(void) const
 {
-       return "Controls::ListView";
+       return "Tizen::Ui::Controls::ListView";
 }
 
 const ListView&
@@ -235,7 +215,7 @@ _ListViewImpl::SetItemProvider(IListViewItemProvider& provider)
        {
                pProviderAdaptor = new (std::nothrow) _ListViewItemProviderAdaptor(provider);
                SysTryReturn(NID_UI_CTRL, (pProviderAdaptor != null), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
-                                       "[E_OUT_OF_MEMORY] The memory is insufficient.");
+                               "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
                pProviderAdaptor->SetListViewItemEventListener(*this);
 
@@ -512,7 +492,7 @@ _ListViewImpl::ScrollToItem(int index, ListScrollItemAlignment itemAlignment)
        else
        {
                SysTryReturn(NID_UI_CTRL, false, E_OUT_OF_RANGE, E_OUT_OF_RANGE,
-                                        "[E_OUT_OF_RANGE] The specified itemAlignment is out of range.");
+                               "[E_OUT_OF_RANGE] The specified itemAlignment is out of range.");
        }
 
        SetLastResultReturn(r);
@@ -590,8 +570,7 @@ _ListViewImpl::RefreshList(int index, ListRefreshType type, bool needFlush)
 
        int itemCount = GetCore().GetItemCountAt(0);
 
-       if ((index < 0) || (index > itemCount) ||
-               ((type != LIST_REFRESH_TYPE_ITEM_ADD) && (index == itemCount)))
+       if ((index < 0) || (index > itemCount) || ((type != LIST_REFRESH_TYPE_ITEM_ADD) && (index == itemCount)))
        {
                SysLogException(NID_UI_CTRL, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The index is out of range.");
                return E_OUT_OF_RANGE;
@@ -644,14 +623,10 @@ _ListViewImpl::RefreshList(int index, ListRefreshType type, bool needFlush)
                                itemDrawingStatus = pListViewItem->GetDrawingStatus();
                                itemSelected = pListViewItem->GetSelectionState();
                                touchPosition = pListViewItem->GetLastTouchPressedPositionF();
-
-                               pListViewItem = null;
                        }
 
                        GetCore().UnloadItem(0, index);
-                       GetCore().LoadItem(0, index);
-
-                       pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(0, index));
+                       pListViewItem = static_cast<_ListViewItem*>(GetCore().LoadItem(0, index));
 
                        if ((pListViewItem != null) && (itemDrawingStatus != TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL))
                        {
@@ -1138,8 +1113,7 @@ _ListViewImpl::OnTableViewItemStateChanged(_TableView& tableView, int itemIndex,
                        if ((__pLinkEvent != null) && (itemInfo.pUiLinkInfo != null))
                        {
                                IEventArg* pLinkEventArg = _PublicLinkEvent::CreateLinkEventArgN(itemInfo.pUiLinkInfo->textInfo,
-                                                                                                                                                                itemInfo.pUiLinkInfo->linkType,
-                                                                                                                                                                itemInfo.pUiLinkInfo->linkInfo);
+                                               itemInfo.pUiLinkInfo->linkType, itemInfo.pUiLinkInfo->linkInfo);
 
                                SysTryReturnVoidResult(NID_UI_CTRL, (pLinkEventArg != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create _LinkEventArg.");
                                __pLinkEvent->Fire(*pLinkEventArg);
@@ -1371,11 +1345,8 @@ _ListViewImpl::OnFontInfoRequested(unsigned long& style, int& size)
 void
 _ListViewImpl::OnFontInfoRequested(unsigned long& style, float& size)
 {
-       float textSize = 0.0f;
-       GET_SHAPE_CONFIG(LISTVIEW::EMPTY_LIST_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, textSize);
-
+       GET_SHAPE_CONFIG(LISTVIEW::EMPTY_LIST_TEXT_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, size);
        style = FONT_STYLE_PLAIN;
-       size = textSize;
 }
 
 bool
@@ -1646,4 +1617,3 @@ _ListViewRegister::~_ListViewRegister()
 
 static _ListViewRegister ListViewRegisterToUIbuilder;
 }}} // Tizen::Ui::Controls
-