From: Hwankyu Jhun Date: Thu, 25 Jul 2019 02:07:21 +0000 (+0900) Subject: Change method parameters X-Git-Tag: submit/tizen/20190730.054929~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42ead40516e0ed62dd63258e5fced13705f3753e;p=platform%2Fcore%2Fappfw%2Fcomponent-based-application.git Change method parameters The types are changed 'std::string' to 'const std::string&'. Change-Id: Iac7e42e745fb6b6560a6eed4e6596b4c83848194 Signed-off-by: Hwankyu Jhun --- diff --git a/component_based/base/component_manager_internal.cc b/component_based/base/component_manager_internal.cc index 90c57e1..fef7b58 100644 --- a/component_based/base/component_manager_internal.cc +++ b/component_based/base/component_manager_internal.cc @@ -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 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 win) { +bool ComponentManager::Bind(const std::string& inst_id, + std::unique_ptr 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 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); diff --git a/component_based/base/component_manager_internal.h b/component_based/base/component_manager_internal.h index df14638..34c424e 100644 --- a/component_based/base/component_manager_internal.h +++ b/component_based/base/component_manager_internal.h @@ -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 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 win); - void Unbind(std::string inst_id); + bool Bind(const std::string& inst_id, std::unique_ptr 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,