Add is_type_exist function to an abstract item
[platform/core/api/notification.git] / notification-ex / icon_text_item.h
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 #ifndef NOTIFICATION_EX_ICON_TEXT_ITEM_H_
18 #define NOTIFICATION_EX_ICON_TEXT_ITEM_H_
19
20 #include <string>
21 #include <memory>
22 #include <list>
23
24 #include "notification-ex/abstract_item.h"
25 #include "notification-ex/icon_item.h"
26 #include "notification-ex/text_item.h"
27
28 namespace notification {
29 namespace item {
30
31 /**
32  * @brief The class for IconTextItem type notification.
33  * @details The class to make the notification with icon and text.
34  * @since_tizen 5.5
35  */
36 class EXPORT_API IconTextItem : public AbstractItem {
37  public:
38   /**
39    * @brief Constructor
40    * @since_tizen 5.5
41    * @param[in] id The IconTextItem id
42    * @param[in] icon The icon of IconTextItem
43    * @param[in] text The text of IconTextItem
44    * @param[in] action The action for IconTextItem
45    */
46   IconTextItem(std::string id, std::shared_ptr<IconItem> icon,
47     std::shared_ptr<TextItem> text,
48     std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}));
49
50   /**
51    * @brief Destructor
52    * @since_tizen 5.5
53    */
54   virtual ~IconTextItem();
55
56   /**
57    * @brief Serialize the data of IconTextItem.
58    * @since_tizen 5.5
59    * @return Bundle type data
60    */
61   Bundle Serialize() const override;
62
63   /**
64    * @brief Deserialize the serialized data.
65    * @since_tizen 5.5
66    * @param[in] b The serialized Bundle data
67    */
68   void Deserialize(Bundle b) override;
69
70   /**
71    * @brief Finds the AbstractItem using by notification item id.
72    * @since_tizen 5.5
73    * @param[in] id notification item id
74    * @return AbstractItem object
75    */
76   AbstractItem& FindByID(std::string id) override;
77
78   /**
79    * @brief Checks the item type exist in this notification.
80    * @since_tizen 5.5
81    * @param[in] type notification item type
82    * @return true if the item type exists
83    */
84   bool IsItemTypeExist(int type) override;
85
86   /**
87    * @brief Gets the type of IconTextItem.
88    * @since_tizen 5.5
89    * @return AbstractItem::Type::IconText
90    */
91   int GetType() const override;
92
93   /**
94    * @brief Gets the IconItem of IconTextItem.
95    * @since_tizen 5.5
96    * @return The IconItem object
97    */
98   IconItem& GetIconItem() const;
99
100   /**
101    * @brief Gets the TextItem of IconTextItem.
102    * @since_tizen 5.5
103    * @return The TextItem object
104    */
105   TextItem& GetTextItem() const;
106
107  private:
108   class Impl;
109   std::unique_ptr<Impl> impl_;
110 };  // class IconTextItem
111
112 }  // namespace item
113 }  // namespace notification
114 #endif  // NOTIFICATION_EX_ICON_TEXT_ITEM_H_