From 99a518fc7038da140fc95b56f7e415a03cc2d4e5 Mon Sep 17 00:00:00 2001 From: Kazumasa Mitsunari Date: Sun, 10 Jun 2018 23:46:49 +0900 Subject: Change API in applist * getActions * getRequest This is because these functions doesn't check the elements is in or not. So if there is no element, second parameter bool should be used to check. Change-Id: I0aab79d3317a15d82ca21a40a65f29a2aed07fb3 Signed-off-by: Kazumasa Mitsunari --- src/applist.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/applist.cpp') diff --git a/src/applist.cpp b/src/applist.cpp index b5c1681..13e677c 100644 --- a/src/applist.cpp +++ b/src/applist.cpp @@ -177,23 +177,28 @@ unsigned AppList::addAllocateRequest(WMRequest req) return req.req_num; // return 1; if you test time_expire } -struct WMTrigger AppList::getRequest(unsigned req_num) +struct WMTrigger AppList::getRequest(unsigned req_num, bool *found) { + *found = false; for (const auto &x : this->req_list) { if (req_num == x.req_num) { + *found = true; return x.trigger; } } + return WMTrigger{"", "", "", Task::TASK_INVALID}; } -const vector &AppList::getActions(unsigned req_num) +const vector &AppList::getActions(unsigned req_num, bool* found) { + *found = false; for (auto &x : this->req_list) { if (req_num == x.req_num) { + *found = true; return x.sync_draw_req; } } -- cgit 1.2.3-korg