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