From 794169028056d420f6f9bb0bf50010673a0836b0 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Wed, 6 Jul 2016 21:20:53 +0900 Subject: [PATCH] c++: use ranged-loop style. ranged-loop is supported in c++ 11. This makes code cleaner. Change-Id: I6a8e375f742febbc7f488d4ebfb2a875b3ca7ec1 --- src/lib/interface/UiIfaceViewmgr.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) 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; } } -- 2.7.4