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/default_item_factory.h"
22 #include "notification-ex/button_item.h"
23 #include "notification-ex/group_item.h"
24 #include "notification-ex/entry_item.h"
25 #include "notification-ex/text_item.h"
26 #include "notification-ex/exception.h"
27 #include "notification-ex/input_selector_item.h"
28 #include "notification-ex/progress_item.h"
29 #include "notification-ex/icon_item.h"
30 #include "notification-ex/image_item.h"
31 #include "notification-ex/checkbox_item.h"
32 #include "notification-ex/chat_message_item.h"
33 #include "notification-ex/time_item.h"
39 #define LOG_TAG "NOTIFICATION_EX"
42 namespace notification {
45 unique_ptr<AbstractItem> DefaultItemFactory::CreateItem(int type) {
47 case AbstractItem::NullObject :
48 THROW(ERROR_INVALID_PARAMETER);
49 case AbstractItem::Text :
50 return unique_ptr<AbstractItem>(new TextItem("", ""));
51 case AbstractItem::Icon :
52 return unique_ptr<AbstractItem>(new IconItem(""));
53 case AbstractItem::Image :
54 return unique_ptr<AbstractItem>(new ImageItem(""));
55 case AbstractItem::Button :
56 return unique_ptr<AbstractItem>(new ButtonItem(""));
57 case AbstractItem::ChatMessage :
58 return unique_ptr<AbstractItem>(new ChatMessageItem("",
59 nullptr, nullptr, nullptr, nullptr, ChatMessageItem::Type::user));
60 case AbstractItem::CheckBox :
61 return unique_ptr<AbstractItem>(new CheckBoxItem("", ""));
62 case AbstractItem::InputSelector :
63 return unique_ptr<AbstractItem>(new InputSelectorItem());
64 case AbstractItem::Group :
65 return unique_ptr<AbstractItem>(new GroupItem());
66 case AbstractItem::Entry :
67 return unique_ptr<AbstractItem>(new EntryItem(""));
68 case AbstractItem::Progress :
69 return unique_ptr<AbstractItem>(new ProgressItem(0.0, 0.0, 0.0));
70 case AbstractItem::Time :
71 return unique_ptr<AbstractItem>(new TimeItem());
72 case AbstractItem::Custom :
73 return unique_ptr<AbstractItem>(new ButtonItem(""));
80 } // namespace notification