Fix some lines for proper coding convention.
authorJihun Ha <jihun.ha@samsung.com>
Thu, 18 May 2017 10:37:37 +0000 (19:37 +0900)
committerUze Choi <uzchoi@samsung.com>
Sat, 20 May 2017 08:23:40 +0000 (08:23 +0000)
Some brace locations are changed to better coding convention in scene manager

Change-Id: Id8edd9fbdf582ffcae1bfd8ba239e13a875f2068
Signed-off-by: Jihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20037
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/scene-manager/sampleapp/linux/sceneclient.cpp [changed mode: 0644->0755]
service/scene-manager/sampleapp/linux/sceneserver.cpp [changed mode: 0644->0755]
service/scene-manager/src/RemoteScene.cpp [changed mode: 0644->0755]
service/scene-manager/src/RemoteSceneCollection.cpp [changed mode: 0644->0755]
service/scene-manager/src/RemoteSceneList.cpp [changed mode: 0644->0755]
service/scene-manager/unittests/RemoteSceneCollectionTest.cpp [changed mode: 0644->0755]
service/scene-manager/unittests/SceneTest.cpp [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 546c1db..e9e3b1d
@@ -148,7 +148,9 @@ void onRemoteSceneActionCreated(RemoteSceneAction::Ptr, int eCode)
     numRecvSceneActionCreationResp++;
 
     if(numCreatedSceneAction == numRecvSceneActionCreationResp)
+    {
         g_currentRun();
+    }
 }
 
 void onRemoteSceneExecuted(const std::string &sceneName, int eCode)
@@ -181,27 +183,42 @@ void createRemoteSceneList()
 
 void createRemoteSceneCollection()
 {
-    if (!g_sceneList) return;
+    if (!g_sceneList)
+    {
+        return;
+    }
 
     g_sceneList->addNewSceneCollection(onRemoteSceneCollectionCreated);
 }
 
 void showRemoteSceneCollection()
 {
-    if (!g_sceneList) return;
+    if (!g_sceneList)
+    {
+        return;
+    }
 
-    if (g_sceneList->getRemoteSceneCollections().size() == 0) return;
+    if (g_sceneList->getRemoteSceneCollections().size() == 0)
+    {
+        return;
+    }
 
     g_sceneCollection = g_sceneList->getRemoteSceneCollections().at(0);
 
-    if( g_sceneCollection->getRemoteScenes().size() == 0) return;
+    if( g_sceneCollection->getRemoteScenes().size() == 0)
+    {
+        return;
+    }
 
     g_scene = g_sceneCollection->getRemoteScenes().begin()->second;
 }
 
 void createRemoteScene()
 {
-    if (!g_sceneCollection) return;
+    if (!g_sceneCollection)
+    {
+        return;
+    }
 
     g_sceneCollection->addNewScene(scene_name, onRemoteSceneCreated);
 }
@@ -254,8 +271,14 @@ int processUserInput(int min, int max)
 
     if (!std::cin.fail())
     {
-        if (input == max + 1)  exit(0);
-        if (min <= input && input <= max) return input;
+        if (input == max + 1)
+        {
+            exit(0);
+        }
+        if (min <= input && input <= max)
+        {
+            return input;
+        }
     }
 
     std::cin.clear();
@@ -266,11 +289,17 @@ int processUserInput(int min, int max)
 
 void displaySceneList()
 {
-    if (!g_sceneList) return;
+    if (!g_sceneList)
+    {
+        return;
+    }
 
     std::cout << "\t" << g_sceneList->getName() << "(SceneList)" << std::endl;
 
-    if (!g_sceneCollection) return;
+    if (!g_sceneCollection)
+    {
+        return;
+    }
 
     std::cout << "\t\t   |_ _ _ " << g_sceneCollection->getId() << " (SceneCollection)" << std::endl;
 
@@ -485,7 +514,8 @@ void runCreateRemoteSceneList()
                 displayClear(runRemoteSceneCollection);
                 break;
         }
-    } catch (std::exception &e)
+    }
+    catch (std::exception &e)
     {
         std::cout << e.what() << std::endl;
         g_currentRun();
@@ -506,7 +536,9 @@ void onResourceDiscovered(std::shared_ptr<RCSRemoteResourceObject> foundResource
 
     // if the found resource is a scene list resource
     if (std::find(vecRTs.begin(), vecRTs.end(), "oic.wk.sceneList") != vecRTs.end())
+    {
         g_foundListResource = foundResource;
+    }
 
     // if the found resource is a light resource
     else if (std::find(vecRTs.begin(), vecRTs.end(), "core.light") != vecRTs.end())
@@ -566,7 +598,9 @@ int main()
         return 0;
     }
 
-    while (true) { }
+    while (true)
+    {
+    }
 
     std::cout << "Stopping the scene client" << std::endl;
 
old mode 100644 (file)
new mode 100755 (executable)
index 8194d06..590f09f
@@ -97,8 +97,14 @@ int processUserInput(int min, int max)
 
     if (!std::cin.fail())
     {
-        if(input == max + 1) throw CloseApp();
-        if(min <= input && input <= max) return input;
+        if(input == max + 1)
+        {
+            throw CloseApp();
+        }
+        if(min <= input && input <= max)
+        {
+            return input;
+        }
     }
 
     std::cin.clear();
old mode 100644 (file)
new mode 100755 (executable)
index 5956d8b..8c72e86
@@ -157,7 +157,9 @@ namespace OIC
                 = m_requestor->getSceneMemberResourceRequestor(targetHref);
 
             if (foundMemberRequestor == nullptr)
+            {
                 m_requestor->createSceneMemberResourceRequestor(href, id, target);
+            }
 
             RCSResourceAttributes attrs;
             attrs[key] = RCSResourceAttributes::Value(value);
@@ -179,7 +181,9 @@ namespace OIC
                 newAction = createRemoteSceneAction(targetLink, attrs);
 
                 if (newAction)
+                {
                     result = SCENE_RESPONSE_SUCCESS;
+                }
             }
 
             clientCB(newAction, result);
old mode 100644 (file)
new mode 100755 (executable)
index 76bab7b..de894e3
@@ -128,7 +128,10 @@ namespace OIC
                             = mappingInfo.at(SCENE_KEY_SCENE).get< std::string >();
 
                         auto remoteScene = m_remoteScenes.find(sceneName);
-                        if (remoteScene == m_remoteScenes.end()) continue;
+                        if (remoteScene == m_remoteScenes.end())
+                        {
+                            continue;
+                        }
 
                         RemoteScene::Ptr pRemoteScene = m_remoteScenes.at(sceneName);
 
old mode 100644 (file)
new mode 100755 (executable)
index ac2ad2c..f9103e3
@@ -255,7 +255,9 @@ namespace OIC
                     createRemoteSceneCollection(link, id, name);
 
                 if (newCollection)
+                {
                     result = SCENE_RESPONSE_SUCCESS;
+                }
             }
 
             clientCB(newCollection, result);
old mode 100644 (file)
new mode 100755 (executable)
index a82a86e..66c7714
@@ -67,7 +67,8 @@ protected:
         g_sceneList->getName();
         discoverSceneListServer();
 
-        if(pSceneList == nullptr){
+        if(pSceneList == nullptr)
+        {
             RemoteSceneList::createInstance(pListResource, std::bind(
                 &RemoteSceneCollectionTest::onRemoteSceneListCreated, this,
                 placeholders::_1, placeholders::_2));
old mode 100644 (file)
new mode 100755 (executable)
index ff63d0e..d76bf06
@@ -107,7 +107,9 @@ private:
     std::condition_variable cond;
     std::mutex mutex;
 };
-void executeCallback(int /*code*/) {};
+void executeCallback(int /*code*/)
+{
+}
 
 TEST_F(SceneTest, createSceneInstance)
 {
@@ -184,7 +186,10 @@ TEST_F(SceneTest, getSceneActions)
 
 TEST_F(SceneTest, executeScene)
 {
-    mocks.ExpectCallFunc(executeCallback).Do([this](int){ proceed(); });
+    mocks.ExpectCallFunc(executeCallback).Do([this](int)
+    {
+        proceed();
+    });
 
     createServer("/a/testuri2_1", "/a/testuri2_2");
     createSceneCollection();