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