diff options
author | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-06-13 19:22:34 +0900 |
---|---|---|
committer | Kazumasa Mitsunari <knimitz@witz-inc.co.jp> | 2018-06-13 19:31:35 +0900 |
commit | aa14c646b5813e09e1e1d1f4cb6da856bf00b886 (patch) | |
tree | 325ffc5779e338d9433068b166ef7d9660f257f1 | |
parent | c79b70f564aaad2194c4f24a653fbb94b7ac397a (diff) |
Add getAppID
Change-Id: I88b20106ea40067b99e6aefed9bcd4187b9664b6
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
-rw-r--r-- | src/applist.cpp | 29 | ||||
-rw-r--r-- | 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<WMClient> 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<WMClient> 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; |