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.
21 #include "notification-ex/item_factory.h"
22 #include "notification-ex/button_item.h"
23 #include "notification-ex/group_item.h"
24 #include "notification-ex/null_item.h"
25 #include "notification-ex/exception.h"
26 #include "notification-ex/input_selector_item.h"
27 #include "notification-ex/progress_item.h"
33 #define LOG_TAG "NOTIFICATION_EX"
36 namespace notification {
39 shared_ptr<AbstractItem> ItemFactory::CreateItem(AbstractItem::Type type) {
41 case AbstractItem::NullObject :
42 THROW(NOTIFICATION_ERROR_INVALID_PARAMETER);
43 case AbstractItem::Text :
44 return make_shared<ButtonItem>("");
45 case AbstractItem::Icon :
46 return make_shared<ButtonItem>("");
47 case AbstractItem::Image :
48 return make_shared<ButtonItem>("");
49 case AbstractItem::Button :
50 return make_shared<ButtonItem>("");
51 case AbstractItem::ChatMessage :
52 return make_shared<ButtonItem>("");
53 case AbstractItem::CheckBox :
54 return make_shared<ButtonItem>("");
55 case AbstractItem::IconText :
56 return make_shared<ButtonItem>("");
57 case AbstractItem::InputSelector :
58 return make_shared<InputSelectorItem>();
59 case AbstractItem::Group :
60 return make_shared<GroupItem>();
61 case AbstractItem::Effect :
62 return make_shared<ButtonItem>("");
63 case AbstractItem::Progress :
64 return make_shared<ProgressItem>(0.0, 0.0, 0.0);
65 case AbstractItem::Custom :
66 return make_shared<ButtonItem>("");
72 AbstractItem& ItemFactory::GetNullItem() {
78 } // namespace notification