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/icon_text_item.h"
31 #include "notification-ex/image_item.h"
32 #include "notification-ex/checkbox_item.h"
33 #include "notification-ex/chat_message_item.h"
34 #include "notification-ex/time_item.h"
40 #define LOG_TAG "NOTIFICATION_EX"
43 namespace notification {
46 unique_ptr<AbstractItem> DefaultItemFactory::CreateItem(int type) {
48 case AbstractItem::NullObject :
49 THROW(ERROR_INVALID_PARAMETER);
50 case AbstractItem::Text :
51 return unique_ptr<AbstractItem>(new TextItem("", ""));
52 case AbstractItem::Icon :
53 return unique_ptr<AbstractItem>(new IconItem(""));
54 case AbstractItem::Image :
55 return unique_ptr<AbstractItem>(new ImageItem(""));
56 case AbstractItem::Button :
57 return unique_ptr<AbstractItem>(new ButtonItem(""));
58 case AbstractItem::ChatMessage :
59 return unique_ptr<AbstractItem>(new ChatMessageItem("",
60 nullptr, nullptr, nullptr, nullptr, ChatMessageItem::Type::user));
61 case AbstractItem::CheckBox :
62 return unique_ptr<AbstractItem>(new CheckBoxItem("", ""));
63 case AbstractItem::IconText :
64 return unique_ptr<AbstractItem>(new IconTextItem("", nullptr, nullptr));
65 case AbstractItem::InputSelector :
66 return unique_ptr<AbstractItem>(new InputSelectorItem());
67 case AbstractItem::Group :
68 return unique_ptr<AbstractItem>(new GroupItem());
69 case AbstractItem::Entry :
70 return unique_ptr<AbstractItem>(new EntryItem(""));
71 case AbstractItem::Progress :
72 return unique_ptr<AbstractItem>(new ProgressItem(0.0, 0.0, 0.0));
73 case AbstractItem::Time :
74 return unique_ptr<AbstractItem>(new TimeItem());
75 case AbstractItem::Custom :
76 return unique_ptr<AbstractItem>(new ButtonItem(""));
83 } // namespace notification