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