Git Init
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / Contact / EventAddressBookChangeListener.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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 /**
18  * @file        EventAddressBookChangeListener.h
19  * @author      Kisub Song (kisubs.song@samsung.com)
20  * @version     0.1
21  * @brief
22  */
23
24 #ifndef _API_CONTACT_EVENT_ADDRESS_BOOK_CHANGE_LISTENER_H_
25 #define _API_CONTACT_EVENT_ADDRESS_BOOK_CHANGE_LISTENER_H_
26
27 #include <string>
28 #include <dpl/shared_ptr.h>
29 #include <Commons/IEvent.h>
30 #include <Commons/ListenerEvent.h>
31 #include <Commons/ListenerEventEmitter.h>
32 #include "Contact.h"
33
34 namespace TizenApis {
35 namespace Api {
36 namespace Contact {
37
38 class EventInfoAddressBookChange;
39 typedef DPL::SharedPtr<EventInfoAddressBookChange> EventInfoAddressBookChangePtr;
40
41 class EventAddressBookChangeListener : public WrtDeviceApis::Commons::ListenerEvent<EventAddressBookChangeListener>
42 {
43 private:
44         EventInfoAddressBookChangePtr m_eventInfo;
45
46 public:
47         EventAddressBookChangeListener(EventInfoAddressBookChangePtr &eventInfo) : m_eventInfo(eventInfo)
48         {
49         }
50
51         EventInfoAddressBookChangePtr getEventInfo() const { return m_eventInfo; }
52 };
53 typedef DPL::SharedPtr<EventAddressBookChangeListener> EventAddressBookChangeListenerPtr;
54
55 typedef WrtDeviceApis::Commons::ListenerEventEmitter<EventAddressBookChangeListener> EventAddressBookChangeListenerEmitter;
56 typedef DPL::SharedPtr<EventAddressBookChangeListenerEmitter> EventAddressBookChangeListenerEmitterPtr;
57
58 class EventInfoAddressBookChange
59 {
60 private:
61
62 public:
63         EventInfoAddressBookChange()
64         {
65         }
66
67         virtual ~EventInfoAddressBookChange()
68         {
69         }
70
71         enum CallbackType
72         {
73                 OnContactsAdded,
74                 OnContactsUpdated,
75                 OnContactsRemoved,
76                 OnAddressBookReset,
77                 OnError
78         };
79
80         virtual CallbackType getCallbackType() const = 0;
81 };
82
83 class EventInfoAddressBookChangeAdded : public EventInfoAddressBookChange
84 {
85 private:
86         /* results */
87         ContactArrayPtr         m_contacts;
88
89         bool            m_contactsIsSet;
90
91 public:
92         EventInfoAddressBookChangeAdded() : m_contactsIsSet(false)
93         {
94         }
95
96         virtual ~EventInfoAddressBookChangeAdded()
97         {
98         }
99
100         virtual CallbackType getCallbackType() const
101         {
102                 return OnContactsAdded;
103         }
104
105     ContactArrayPtr getContacts() const
106     {
107         return m_contacts;
108     }
109
110     void setContacts(ContactArrayPtr contacts)
111     {
112         m_contactsIsSet = true;
113         m_contacts = contacts;
114     }
115
116     bool getContactsIsSet() const
117     {
118         return m_contactsIsSet;
119     }
120 };
121 typedef DPL::SharedPtr<EventInfoAddressBookChangeAdded> EventInfoAddressBookChangeAddedPtr;
122
123 class EventInfoAddressBookChangeUpdated : public EventInfoAddressBookChange
124 {
125 private:
126         /* results */
127         ContactArrayPtr         m_contacts;
128
129         bool            m_contactsIsSet;
130
131 public:
132         EventInfoAddressBookChangeUpdated() : m_contactsIsSet(false)
133         {
134         }
135
136         virtual ~EventInfoAddressBookChangeUpdated()
137         {
138         }
139
140         virtual CallbackType getCallbackType() const
141         {
142                 return OnContactsUpdated;
143         }
144
145     ContactArrayPtr getContacts() const
146     {
147         return m_contacts;
148     }
149
150     void setContacts(ContactArrayPtr contacts)
151     {
152         m_contactsIsSet = true;
153         m_contacts = contacts;
154     }
155
156     bool getContactsIsSet() const
157     {
158         return m_contactsIsSet;
159     }
160 };
161 typedef DPL::SharedPtr<EventInfoAddressBookChangeUpdated> EventInfoAddressBookChangeUpdatedPtr;
162
163 class EventInfoAddressBookChangeRemoved : public EventInfoAddressBookChange
164 {
165 private:
166         /* results */
167         StringArrayPtr          m_contactIds;
168
169         bool    m_contactIdsIsSet;
170
171 public:
172         EventInfoAddressBookChangeRemoved() : m_contactIdsIsSet(false)
173         {
174         }
175
176         virtual ~EventInfoAddressBookChangeRemoved()
177         {
178         }
179
180         virtual CallbackType getCallbackType() const
181         {
182                 return OnContactsRemoved;
183         }
184
185         StringArrayPtr getContactIds() const
186     {
187         return m_contactIds;
188     }
189
190     void setContactIds(StringArrayPtr contactIds)
191     {
192         m_contactIdsIsSet = true;
193         m_contactIds = contactIds;
194     }
195
196     bool getContactIdsIsSet() const
197     {
198         return m_contactIdsIsSet;
199     }
200 };
201 typedef DPL::SharedPtr<EventInfoAddressBookChangeRemoved> EventInfoAddressBookChangeRemovedPtr;
202
203 class EventInfoAddressBookChangeReset : public EventInfoAddressBookChange
204 {
205 private:
206         /* results */
207
208 public:
209         EventInfoAddressBookChangeReset()
210         {
211         }
212
213         virtual ~EventInfoAddressBookChangeReset()
214         {
215         }
216
217         virtual CallbackType getCallbackType() const
218         {
219                 return OnAddressBookReset;
220         }
221 };
222 typedef DPL::SharedPtr<EventInfoAddressBookChangeReset> EventInfoAddressBookChangeResetPtr;
223
224 class EventInfoAddressBookChangeError : public EventInfoAddressBookChange
225 {
226 private:
227         /* results */
228
229 public:
230         EventInfoAddressBookChangeError()
231         {
232         }
233
234         virtual ~EventInfoAddressBookChangeError()
235         {
236         }
237
238         virtual CallbackType getCallbackType() const
239         {
240                 return OnError;
241         }
242 };
243 typedef DPL::SharedPtr<EventInfoAddressBookChangeError> EventInfoAddressBookChangeErrorPtr;
244
245 } // Contact
246 } // Api
247 } // TizenApis
248
249 #endif // _API_CONTACT_EVENT_ADDRESS_BOOK_CHANGE_LISTENER_H_