Include header file about string
[platform/core/api/notification.git] / notification-ex / reporter.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_REPORTER_H_
18 #define NOTIFICATION_EX_REPORTER_H_
19
20 #include <string>
21 #include <list>
22 #include <memory>
23
24 #include "notification-ex/common.h"
25 #include "notification-ex/ievent_info.h"
26 #include "notification-ex/event_observer_interface.h"
27 #include "notification-ex/event_sender_interface.h"
28 #include "notification-ex/event_listener_interface.h"
29 #include "notification-ex/abstract_item.h"
30
31 #ifndef EXPORT_API
32 #define EXPORT_API __attribute__((visibility("default")))
33 #endif
34
35 namespace notification {
36
37 class EXPORT_API Reporter : public IEventObserver {
38  public:
39   Reporter(std::unique_ptr<IEventSender> sender,
40         std::unique_ptr<IEventListener> listener);
41   virtual ~Reporter();
42
43   int SendEvent(const IEventInfo& info,
44       std::list<std::shared_ptr<item::AbstractItem>> notiList);
45   void SendError(const IEventInfo& info, NotificationError error);
46   int Post(std::shared_ptr<item::AbstractItem> noti);
47   int Post(std::list<std::shared_ptr<item::AbstractItem>> notiList);
48   int Update(std::shared_ptr<item::AbstractItem> noti);
49   int Update(std::list<std::shared_ptr<item::AbstractItem>> notiList);
50   int Delete(std::shared_ptr<item::AbstractItem> noti);
51   int Delete(std::list<std::shared_ptr<item::AbstractItem>> notiList);
52   int DeleteAll();
53   int DeleteByChannel(std::string channel);
54   std::unique_ptr<item::AbstractItem> FindByRootID(std::string id);
55   std::list<std::unique_ptr<item::AbstractItem>> FindByChannel(std::string channel);
56   std::list<std::unique_ptr<item::AbstractItem>> FindAll();
57   virtual void OnEvent(const IEventInfo& info,
58       std::list<std::shared_ptr<item::AbstractItem>> notiList);
59   virtual std::list<std::shared_ptr<item::AbstractItem>> OnRequestEvent(
60       const IEventInfo& info);
61   virtual void OnError(NotificationError error, int requestId);
62   void OnEvent(const IEventInfo& info,
63       std::list<tizen_base::Bundle> serialized) override;
64   std::list<tizen_base::Bundle> OnRequest(const IEventInfo& info) override;
65   int OnRequestNumber(const IEventInfo& info) override;
66   static std::string GetPath();
67   virtual void OnRegister(const IEventInfo& info);
68
69  private:
70   class Impl;
71   std::unique_ptr<Impl> impl_;
72 };
73
74 }  // namespace notification
75
76 #endif  // NOTIFICATION_EX_REPORTER_H_