From aa14c646b5813e09e1e1d1f4cb6da856bf00b886 Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Wed, 13 Jun 2018 19:22:34 +0900 Subject: Add getAppID Change-Id: I88b20106ea40067b99e6aefed9bcd4187b9664b6 Signed-off-by: Kazumasa Mitsunari --- src/applist.cpp | 29 ++++++++++++++++++++++++++--- src/applist.hpp | 1 + 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/applist.cpp b/src/applist.cpp index 4e0dc11..919c099 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -133,15 +133,38 @@ shared_ptr AppList::lookUpClient(const string &appid) * * Returns the number of client stored in the list. * - * @param string[in] application id(key) - * @return WMClient object - * @attention Must call cantains to check appid is stored before this function. + * @param None + * @return The number of client */ int AppList::countClient() const { return this->app2client.size(); } +/** + * Get AppID with surface and role. + * + * Returns AppID if found. + * + * @param unsigned[in] surfaceID + * @param string[in] role + * @param bool[in,out] (key) + * @return WMClient object + * @attention If AppID is not found, param found will be false. + */ +string AppList::getAppID(unsigned surface, const string& role, bool* found) const +{ + *found = false; + for (const auto &x : this->app2client) + { + if(x.second->surfaceID(role) == surface){ + *found = true; + return x.second->appID(); + } + } + return string(""); +} + // =================== Request Date container API =================== /** diff --git a/src/applist.hpp b/src/applist.hpp index eaa7e99..6305a4b 100644 --- a/src/applist.hpp +++ b/src/applist.hpp @@ -48,6 +48,7 @@ class AppList int countClient() const; std::shared_ptr lookUpClient(const std::string &appid); void removeSurface(unsigned surface); + std::string getAppID(unsigned surface, const std::string &role, bool *found) const; // Request Interface unsigned currentRequestNumber() const; -- cgit 1.2.3-korg