Add Api for ItemInfo
[platform/core/api/notification.git] / notification-ex / item_info.cc
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <dlog.h>
18
19 #include <memory>
20 #include <algorithm>
21
22 #include "notification-ex/item_info_internal.h"
23
24 #ifdef LOG_TAG
25 #undef LOG_TAG
26 #endif
27
28 #define LOG_TAG "NOTIFICATION_EX"
29
30 using namespace std;
31 namespace notification {
32 namespace item {
33
34 AbstractItem::Impl::ItemInfo::ItemInfo(AbstractItem::Impl* impl) : impl_(impl) {
35 }
36 int AbstractItem::Impl::ItemInfo::GetUid() const {
37   return impl_->uid_;
38 }
39
40 void AbstractItem::Impl::ItemInfo::SetUid(int uid) {
41   impl_->uid_ = uid;
42 }
43
44 time_t AbstractItem::Impl::ItemInfo::GetTime() const {
45   return impl_->time_;
46 }
47
48 void AbstractItem::Impl::ItemInfo::SetTime(time_t time) {
49   impl_->time_ = time;
50 }
51
52 int AbstractItem::Impl::ItemInfo::GetVersion() const {
53   return impl_->version_;
54 }
55
56 void AbstractItem::Impl::ItemInfo::SetVersion(int ver) {
57   impl_->version_ = ver;
58 }
59
60 void AbstractItem::Impl::ItemInfo::SetHideTime(int hide_time) {
61   impl_->hide_time_ = hide_time;
62 }
63
64 int AbstractItem::Impl::ItemInfo::GetHideTime() const {
65   return impl_->hide_time_;
66 }
67
68 void AbstractItem::Impl::ItemInfo::SetDeleteTime(int delete_time) {
69   impl_->delete_time_ = delete_time;
70 }
71
72 int AbstractItem::Impl::ItemInfo::GetDeleteTime() const {
73   return impl_->delete_time_;
74 }
75
76 void AbstractItem::Impl::ItemInfo::AddHideViewer(std::string appid) {
77   if (find(impl_->hide_viewer_list_.begin(),
78       impl_->hide_viewer_list_.end(), appid) !=
79       impl_->hide_viewer_list_.end()) {
80     return;
81   }
82   impl_->hide_viewer_list_.push_back(appid);
83 }
84
85 std::list<std::string> AbstractItem::Impl::ItemInfo::GetHideViewerList() const {
86   return impl_->hide_viewer_list_;
87 }
88
89 }  // namespace item
90 }  // namespace notification