Remove lookup_id and lookup_name
[apps/agl-service-windowmanager-2017.git] / src / window_manager.cpp
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";