2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 #include "notification-ex/input_selector_item.h"
24 #include "notification-ex/input_selector_item_implementation.h"
25 #include "notification-ex/factory_manager.h"
31 #define LOG_TAG "NOTIFICATION_EX"
32 #define INPUT_SELECTOR_CONTENTS_KEY "__INPUT_SELECTOR_CONTENTS_KEY__"
35 using namespace tizen_base;
37 namespace notification {
40 InputSelectorItem::InputSelectorItem(std::shared_ptr<AbstractAction> action)
41 : AbstractItem(action), impl_(new Impl(this)) {
44 InputSelectorItem::InputSelectorItem(string id, std::shared_ptr<AbstractAction> action)
45 : AbstractItem(id, action), impl_(new Impl(this)) {
48 InputSelectorItem::~InputSelectorItem() = default;
49 InputSelectorItem::Impl::~Impl() = default;
51 InputSelectorItem::Impl::Impl(InputSelectorItem* parent)
53 LOGI("InputSelectorItem impl created");
56 int InputSelectorItem::GetType() const {
57 return AbstractItem::InputSelector;
60 Bundle InputSelectorItem::Serialize() const {
62 b = AbstractItem::Serialize();
63 vector<string> contents_vector {
64 begin(impl_->contents_),
67 b.Add(INPUT_SELECTOR_CONTENTS_KEY, contents_vector);
71 void InputSelectorItem::Deserialize(Bundle b) {
72 AbstractItem::Deserialize(b);
73 vector<string> contents = b.GetStringArray(INPUT_SELECTOR_CONTENTS_KEY);
74 impl_->contents_ = list<string>(contents.begin(), contents.end());
77 bool InputSelectorItem::IsItemTypeExist(int type) {
78 if (GetType() == type)
83 list<string> InputSelectorItem::GetContents() const {
84 return impl_->contents_;
87 void InputSelectorItem::SetContents(list<string> contents) {
88 impl_->contents_ = move(contents);
92 } // namespace notification