Change method parameters 96/210796/3
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 25 Jul 2019 02:07:21 +0000 (11:07 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 25 Jul 2019 03:07:41 +0000 (12:07 +0900)
The types are changed 'std::string' to 'const std::string&'.

Change-Id: Iac7e42e745fb6b6560a6eed4e6596b4c83848194
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
component_based/base/component_manager_internal.cc
component_based/base/component_manager_internal.h

index 90c57e1a062d6f5c544ed065fec8f81515181326..fef7b58104ecf8af92a9d2d8b519d38c06b91f3b 100644 (file)
@@ -27,7 +27,7 @@
 namespace component_based {
 namespace internal {
 
-void ComponentManager::RegisterComponent(std::string comp_id,
+void ComponentManager::RegisterComponent(const std::string& comp_id,
     std::unique_ptr<Component::Factory> factory) {
   auto i = fac_map_.find(comp_id);
   if (i == fac_map_.end()) {
@@ -47,12 +47,13 @@ void ComponentManager::RegisterComponent(std::string comp_id,
   fac_map_[comp_id] = std::move(factory);
 }
 
-void ComponentManager::AddEventListener(std::string inst_id,
+void ComponentManager::AddEventListener(const std::string& inst_id,
     ComponentManager::IEventListener* ev) {
   ev_map_[inst_id] = ev;
 }
 
-void ComponentManager::Start(std::string comp_id, std::string inst_id,
+void ComponentManager::Start(const std::string& comp_id,
+                             const std::string& inst_id,
                              bundle* b) {
   bool restarted = true;
   auto inst_iter = inst_map_.find(inst_id);
@@ -88,21 +89,21 @@ void ComponentManager::Start(std::string comp_id, std::string inst_id,
   }
 }
 
-void ComponentManager::Resume(std::string inst_id) {
+void ComponentManager::Resume(const std::string& inst_id) {
   Ecore_Wl2_Window* wl_win = GetWl2Window(inst_id);
   if (wl_win == nullptr)
     return;
   ecore_wl2_window_activate(wl_win);
 }
 
-void ComponentManager::Pause(std::string inst_id) {
+void ComponentManager::Pause(const std::string& inst_id) {
   Ecore_Wl2_Window* wl_win = GetWl2Window(inst_id);
   if (wl_win == nullptr)
     return;
   ecore_wl2_window_iconified_set(wl_win, EINA_TRUE);
 }
 
-void ComponentManager::Stop(std::string inst_id) {
+void ComponentManager::Stop(const std::string& inst_id) {
   auto ev_iter = ev_map_.find(inst_id);
   if (ev_iter == ev_map_.end())
     return;
@@ -111,7 +112,7 @@ void ComponentManager::Stop(std::string inst_id) {
   ev_map_[inst_id]->OnStop();
 }
 
-bool ComponentManager::IsResumed(std::string inst_id) {
+bool ComponentManager::IsResumed(const std::string& inst_id) {
   appcore_multiwindow_base_instance_h context =
     appcore_multiwindow_base_instance_find(inst_id.c_str());
   if (!context) {
@@ -122,7 +123,7 @@ bool ComponentManager::IsResumed(std::string inst_id) {
   return appcore_multiwindow_base_instance_is_resumed(context);
 }
 
-void ComponentManager::Exit(std::string inst_id) {
+void ComponentManager::Exit(const std::string& inst_id) {
   appcore_multiwindow_base_instance_h context =
       appcore_multiwindow_base_instance_find(inst_id.c_str());
   if (!context) {
@@ -140,7 +141,8 @@ void ComponentManager::ExitAll() {
   }
 }
 
-bool ComponentManager::Bind(std::string inst_id, std::unique_ptr<IWindow> win) {
+bool ComponentManager::Bind(const std::string& inst_id,
+                            std::unique_ptr<IWindow> win) {
   appcore_multiwindow_base_instance_h context =
       appcore_multiwindow_base_instance_find(inst_id.c_str());
   if (!context) {
@@ -160,7 +162,7 @@ bool ComponentManager::Bind(std::string inst_id, std::unique_ptr<IWindow> win) {
   return true;
 }
 
-void ComponentManager::Unbind(std::string inst_id) {
+void ComponentManager::Unbind(const std::string& inst_id) {
   auto win_iter = win_map_.find(inst_id);
   if (win_iter == win_map_.end()) {
     return;
@@ -176,7 +178,7 @@ void ComponentManager::Unbind(std::string inst_id) {
 }
 
 ComponentManager::IEventListener* ComponentManager::GetEventListener(
-    std::string inst_id) {
+    const std::string& inst_id) {
   auto ev_iter = ev_map_.find(inst_id);
   if (ev_iter == ev_map_.end())
     return nullptr;
@@ -194,7 +196,7 @@ std::string ComponentManager::GetInstanceID(int win_id) {
   return std::string("");
 }
 
-const IWindow* ComponentManager::GetWindow(std::string inst_id) {
+const IWindow* ComponentManager::GetWindow(const std::string& inst_id) {
   auto win_iter = win_map_.find(inst_id);
   if (win_iter == win_map_.end())
     return nullptr;
@@ -202,7 +204,7 @@ const IWindow* ComponentManager::GetWindow(std::string inst_id) {
   return &*win_map_[inst_id];
 }
 
-void ComponentManager::AddGroup(std::string inst_id, int surf_id) {
+void ComponentManager::AddGroup(const std::string& inst_id, int surf_id) {
   auto group_iter = group_map_.find(inst_id);
   if (group_iter != group_map_.end())
     return;
@@ -213,7 +215,7 @@ void ComponentManager::AddGroup(std::string inst_id, int surf_id) {
   group_map_[inst_id] = surf_id;
 }
 
-void ComponentManager::RemoveGroup(std::string inst_id) {
+void ComponentManager::RemoveGroup(const std::string& inst_id) {
   auto group_iter = group_map_.find(inst_id);
   if (group_iter == group_map_.end())
     return;
@@ -246,7 +248,7 @@ void ComponentManager::PauseAll() {
   }
 }
 
-Ecore_Wl2_Window* ComponentManager::GetWl2Window(std::string inst_id) {
+Ecore_Wl2_Window* ComponentManager::GetWl2Window(const std::string& inst_id) {
   auto win_iter = win_map_.find(inst_id);
   if (win_iter == win_map_.end())
     return nullptr;
@@ -257,7 +259,7 @@ Ecore_Wl2_Window* ComponentManager::GetWl2Window(std::string inst_id) {
   return win;
 }
 
-void ComponentManager::Remove(std::string inst_id) {
+void ComponentManager::Remove(const std::string& inst_id) {
   RemoveGroup(inst_id);
   ev_map_.erase(inst_id);
   inst_map_.erase(inst_id);
index df14638b8c645741701dfb306c118c5be550a2d7..34c424e51a3cdd237cf9e6c3035d0b0288a46c89 100644 (file)
@@ -52,32 +52,32 @@ class ComponentManager {
     return inst;
   }
 
-  void AddEventListener(std::string inst_id, IEventListener* ev);
-  void RegisterComponent(std::string comp_id,
+  void AddEventListener(const std::string& inst_id, IEventListener* ev);
+  void RegisterComponent(const std::string& comp_id,
                          std::unique_ptr<Component::Factory> factory);
 
-  void Start(std::string comp_id, std::string inst_id, bundle* b);
-  void Resume(std::string inst_id);
-  void Pause(std::string inst_id);
-  bool IsResumed(std::string inst_id);
-  void Stop(std::string inst_id);
+  void Start(const std::string& comp_id, const std::string& inst_id, bundle* b);
+  void Resume(const std::string& inst_id);
+  void Pause(const std::string& inst_id);
+  bool IsResumed(const std::string& inst_id);
+  void Stop(const std::string& inst_id);
 
-  void Exit(std::string inst_id);
+  void Exit(const std::string& inst_id);
   void ExitAll();
-  bool Bind(std::string inst_id, std::unique_ptr<IWindow> win);
-  void Unbind(std::string inst_id);
+  bool Bind(const std::string& inst_id, std::unique_ptr<IWindow> win);
+  void Unbind(const std::string& inst_id);
   std::string GetInstanceID(int win_id);
-  const IWindow* GetWindow(std::string inst_id);
-  void AddGroup(std::string inst_id, int surf_id);
-  void RemoveGroup(std::string inst_id);
+  const IWindow* GetWindow(const std::string& inst_id);
+  void AddGroup(const std::string& inst_id, int surf_id);
+  void RemoveGroup(const std::string& inst_id);
   bool IsEmpty();
   void ResumeAll();
   void PauseAll();
 
  private:
-  IEventListener* GetEventListener(std::string inst_id);
-  Ecore_Wl2_Window* GetWl2Window(std::string inst_id);
-  void Remove(std::string inst_id);
+  IEventListener* GetEventListener(const std::string& inst_id);
+  Ecore_Wl2_Window* GetWl2Window(const std::string& inst_id);
+  void Remove(const std::string& inst_id);
 
  private:
   static void OnCreateCB(appcore_multiwindow_base_instance_h context,