Remove lookup_id and lookup_name
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Tue, 28 Aug 2018 07:13:13 +0000 (16:13 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Tue, 28 Aug 2018 07:13:13 +0000 (16:13 +0900)
No need to wrap object

Change-Id: I2cb403aabd6d55d7b06024e1535c26c48fe74ac7
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
src/window_manager.cpp
src/window_manager.hpp

index d284279..ea3c794 100644 (file)
@@ -272,7 +272,7 @@ result<int> WindowManager::api_request_surface(char const *appid, char const *dr
 
     // generate surface ID for ivi-shell application
 
-    auto rname = this->lookup_id(role);
+    auto rname = this->id_alloc.lookup(string(role));
     if (!rname)
     {
         // name does not exist yet, allocate surface id...
@@ -336,7 +336,7 @@ char const *WindowManager::api_request_surface(char const *appid, char const *dr
         }
     }
 
-    auto rname = this->lookup_id(role);
+    auto rname = this->id_alloc.lookup(str);
 
     if (rname)
     {
@@ -646,7 +646,7 @@ result<json_object *> WindowManager::api_get_area_info(char const *drawing_name)
     const char *role = this->convertRoleOldToNew(drawing_name);
 
     // Check drawing name, surface/layer id
-    auto const &surface_id = this->lookup_id(role);
+    auto const &surface_id = this->id_alloc.lookup(string(role));
     if (!surface_id)
     {
         return Err<json_object *>("Surface does not exist");
@@ -830,7 +830,7 @@ void WindowManager::startTransitionWrapper(vector<WMAction> &actions)
         if ("" != act.role)
         {
             bool found;
-            auto const &surface_id = this->lookup_id(act.role.c_str());
+            auto const &surface_id = this->id_alloc.lookup(act.role);
             string appid = g_app_list.getAppID(*surface_id, act.role, &found);
             if (!found)
             {
@@ -898,15 +898,6 @@ void WindowManager::processError(WMError error)
  ******* Private Functions *******
  */
 
-optional<int> WindowManager::lookup_id(char const *name)
-{
-    return this->id_alloc.lookup(string(name));
-}
-optional<string> WindowManager::lookup_name(int id)
-{
-    return this->id_alloc.lookup(id);
-}
-
 /**
  * init_layers()
  */
@@ -1076,7 +1067,7 @@ void WindowManager::activate(int id)
         this->controller->surfaces[id]->set_visibility(1);
         */
         char const *label =
-            this->lookup_name(id).value_or("unknown-name").c_str();
+            this->id_alloc.lookup(id).value_or("unknown-name").c_str();
 
         /* // FOR CES DEMO >>>
         if ((0 == strcmp(label, "radio")) ||
@@ -1126,7 +1117,7 @@ void WindowManager::deactivate(int id)
     if (ip != this->controller->sprops.end())
     {*/
         char const *label =
-            this->lookup_name(id).value_or("unknown-name").c_str();
+            this->id_alloc.lookup(id).value_or("unknown-name").c_str();
 
         /*// FOR CES DEMO >>>
         if ((0 == strcmp(label, "radio")) ||
@@ -1608,7 +1599,7 @@ int WindowManager::loadOldRoleDb()
 
 const char *WindowManager::check_surface_exist(const char *drawing_name)
 {
-    auto const &surface_id = this->lookup_id(drawing_name);
+    auto const &surface_id = this->id_alloc.lookup(string(drawing_name));
     if (!surface_id)
     {
         return "Surface does not exist";
index afafeb1..3bf62c2 100644 (file)
@@ -229,8 +229,6 @@ class WindowManager
     void processError(WMError error);
 
   private:
-    optional<int> lookup_id(char const *name);
-    optional<std::string> lookup_name(int id);
     int init_layers();
     void surface_set_layout(int surface_id, const std::string& area = "");
     void layout_commit();