From: Hermet Park Date: Wed, 6 Jul 2016 12:20:53 +0000 (+0900) Subject: c++: use ranged-loop style. X-Git-Tag: accepted/tizen/common/20160708.140253~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F10%2F78710%2F1;p=platform%2Fcore%2Fuifw%2Fui-viewmgr.git c++: use ranged-loop style. ranged-loop is supported in c++ 11. This makes code cleaner. Change-Id: I6a8e375f742febbc7f488d4ebfb2a875b3ca7ec1 --- diff --git a/src/lib/interface/UiIfaceViewmgr.cpp b/src/lib/interface/UiIfaceViewmgr.cpp index 9fcb674..69dad97 100644 --- a/src/lib/interface/UiIfaceViewmgr.cpp +++ b/src/lib/interface/UiIfaceViewmgr.cpp @@ -129,15 +129,14 @@ bool UiIfaceViewmgrImpl::connectView(UiIfaceView *view) int nameLen = strlen(view->getName()); const char *name = view->getName(); - for (VIEW_ITR it = this->_viewList.begin(); it != this->_viewList.end(); it++) { - UiIfaceView *view = *it; - const char *viewName = view->getName(); + for (UiIfaceView *v : this->_viewList) { + const char *viewName = v->getName(); if (!viewName) continue; int viewNameLen = strlen(viewName); //Got you! if ((viewNameLen == nameLen) && !strcmp(name, viewName)) { - LOGE("the same name of UiIfaceView(%p) is already in this UiIfaceViewmgr(%p)", view, this); + LOGE("the same name of UiIfaceView(%p) is already in this UiIfaceViewmgr(%p)", v, this); return false; } } @@ -360,8 +359,8 @@ int UiIfaceViewmgrImpl::getViewIndex(const UiIfaceView *view) { int idx = 0; - for (VIEW_ITR it = this->_viewList.begin(); it != this->_viewList.end(); it++) { - if (view == *it) return idx; + for (UiIfaceView *v : this->_viewList) { + if (view == v) return idx; ++idx; } @@ -413,15 +412,14 @@ UiIfaceView *UiIfaceViewmgrImpl::getView(const char *name) if (!name) return NULL; int nameLen = strlen(name); - for (VIEW_ITR it = this->_viewList.begin(); it != this->_viewList.end(); it++) { - UiIfaceView *view = *it; - const char *viewName = view->getName(); + for (UiIfaceView *v : this->_viewList) { + const char *viewName = v->getName(); if (!viewName) continue; int viewNameLen = strlen(viewName); //Got you! if ((viewNameLen == nameLen) && !strcmp(name, viewName)) { - return view; + return v; } }