Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / Calendar / ICalendar.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 #ifndef _ABSTRACT_LAYER_ICALENDAR_H_
19 #define _ABSTRACT_LAYER_ICALENDAR_H_
20
21 #include <string>
22 #include <sstream>
23 #include <dpl/log/log.h>
24 #include <dpl/shared_ptr.h>
25 #include "CalendarEvent.h"
26 #include "EventFilter.h"
27 #include "IEventAddEvent.h"
28 #include "IEventAddEvents.h"
29 #include "IEventCreateEvent.h"
30 #include "IEventDeleteEvent.h"
31 #include "IEventDeleteEvents.h"
32 #include "IEventFindEvents.h"
33 #include "IEventUpdateEvent.h"
34 #include "IEventUpdateEvents.h"
35 #include "IEventCreateEventFromString.h"
36 #include "IEventExportEventToString.h"
37 #include "IEventWatchChanges.h"
38 #include "IEventClearWatch.h"
39 #include "IEventExpandEventRecurrence.h"
40 #include "IEventGet.h"
41 #include "OnAddEventsChanged.h"
42 #include "OnUpdateEventsChanged.h"
43 #include "OnDeleteEventsChanged.h"
44 #include "OnEventsChanged.h"
45
46 namespace TizenApis {
47 namespace Api {
48 namespace Calendar {
49
50 class ICalendar : public WrtDeviceApis::Commons::EventRequestReceiver< IEventAddEvent >,
51     public WrtDeviceApis::Commons::EventRequestReceiver< IEventAddEvents >,
52     public WrtDeviceApis::Commons::EventRequestReceiver< IEventDeleteEvent >,
53     public WrtDeviceApis::Commons::EventRequestReceiver< IEventDeleteEvents >,
54     public WrtDeviceApis::Commons::EventRequestReceiver< IEventUpdateEvent >,
55     public WrtDeviceApis::Commons::EventRequestReceiver< IEventUpdateEvents >,
56     public WrtDeviceApis::Commons::EventRequestReceiver< IEventFindEvents >,
57     public WrtDeviceApis::Commons::EventRequestReceiver< IEventCreateEvent >,
58     public WrtDeviceApis::Commons::EventRequestReceiver< IEventCreateEventFromString >,
59     public WrtDeviceApis::Commons::EventRequestReceiver< IEventExportEventToString >,
60     public WrtDeviceApis::Commons::EventRequestReceiver< IEventWatchChanges >,
61     public WrtDeviceApis::Commons::EventRequestReceiver< IEventClearWatch >,
62     public WrtDeviceApis::Commons::EventRequestReceiver< IEventExpandEventRecurrence >,
63     public WrtDeviceApis::Commons::EventRequestReceiver< IEventGet >
64 {
65   public:
66     ICalendar();
67     virtual ~ICalendar();
68     virtual void                createEvent(IEventCreateEventPtr &event);
69     virtual void                addEvent(IEventAddEventPtr &event);
70     virtual void                addEvents(IEventAddEventsPtr &events);
71     virtual void                updateEvent(IEventUpdateEventPtr &event);
72     virtual void                updateEvents(IEventUpdateEventsPtr &events);
73     virtual void                deleteEvent(IEventDeleteEventPtr &event);
74     virtual void                deleteEvents(IEventDeleteEventsPtr &events);
75     virtual void                findEvents(IEventFindEventsPtr &event);
76     virtual void                createEventFromString(IEventCreateEventFromStringPtr &event);
77     virtual void                exportEventToString(IEventExportEventToStringPtr &event);
78     virtual void                watchChanges(IEventWatchChangesPtr &event);
79     virtual void                clearWatch(IEventClearWatchPtr &event);
80         virtual void                            expandEventRecurrence(IEventExpandEventRecurrencePtr &event);
81         virtual void                            get(IEventGetPtr &event);
82
83     virtual std::string         getName() const
84     {
85         return m_name;
86     }
87     virtual void                setName(const std::string &value)
88     {
89         m_name = value;
90     }
91
92     virtual CalendarEvent::CalendarType        getType() const
93     {
94         return m_type;
95     }
96     virtual void                setType(const CalendarEvent::CalendarType value)
97     {
98         m_type = value;
99     }
100
101     virtual std::string                 getId() const
102     {
103         return m_id;
104     }
105     virtual void                setId(const int value)
106     {
107         std::stringstream ss;
108         ss<<value;
109         m_id = ss.str();
110     }
111
112     virtual int                 getAccountId() const
113     {
114         return m_accountId;
115     }
116     virtual void                setAccountId(const int value)
117     {
118         m_accountId = value;
119     }
120
121     virtual OnAddEventsChangedEmitterPtr getAddEmitter() const
122     {
123         return m_addEmitter;
124     }
125     virtual void                setAddEmitter(OnAddEventsChangedEmitterPtr value)
126     {
127         m_addEmitter = value;
128     }
129
130     virtual OnUpdateEventsChangedEmitterPtr getUpdateEmitter() const
131     {
132         return m_updateEmitter;
133     }
134     virtual void                setUpdateEmitter(OnUpdateEventsChangedEmitterPtr value)
135     {
136         m_updateEmitter = value;
137     }
138
139     virtual OnDeleteEventsChangedEmitterPtr getDeleteEmitter() const
140     {
141         return m_deleteEmitter;
142     }
143     virtual void                setDeleteEmitter(OnDeleteEventsChangedEmitterPtr value)
144     {
145         m_deleteEmitter = value;
146     }
147
148     virtual std::time_t getLastChangeFetchTime()
149     {
150         return m_lastChangeFetchTime;
151     }
152     virtual void                setLastChangeFetchTime(std::time_t value)
153     {
154         m_lastChangeFetchTime = value;
155     }
156
157     OnEventsChangedEmitters m_changeEmitters;
158
159   protected:
160     std::string m_id;
161     int m_accountId;
162     std::string m_name;
163     CalendarEvent::CalendarType m_type;
164     OnAddEventsChangedEmitterPtr m_addEmitter;
165     OnUpdateEventsChangedEmitterPtr m_updateEmitter;
166     OnDeleteEventsChangedEmitterPtr m_deleteEmitter;
167     std::time_t m_lastChangeFetchTime;
168
169     virtual void OnRequestReceived(const IEventAddEventPtr &event) = 0;
170     virtual void OnRequestReceived(const IEventAddEventsPtr &events) = 0;
171     virtual void OnRequestReceived(const IEventDeleteEventPtr &event) = 0;
172     virtual void OnRequestReceived(const IEventDeleteEventsPtr &events) = 0;
173     virtual void OnRequestReceived(const IEventUpdateEventPtr &event) = 0;
174     virtual void OnRequestReceived(const IEventUpdateEventsPtr &events) = 0;
175     virtual void OnRequestReceived(const IEventFindEventsPtr &event) = 0;
176     virtual void OnRequestReceived(const IEventCreateEventPtr &event) = 0;
177     virtual void OnRequestReceived(const IEventCreateEventFromStringPtr &event) = 0;
178     virtual void OnRequestReceived(const IEventExportEventToStringPtr &event) = 0;
179     virtual void OnRequestReceived(const IEventWatchChangesPtr &event) = 0;
180     virtual void OnRequestReceived(const IEventClearWatchPtr &event) = 0;
181     virtual void OnRequestReceived(const IEventExpandEventRecurrencePtr &event) = 0;
182     virtual void OnRequestReceived(const IEventGetPtr &event) = 0;
183 };
184
185 typedef DPL::SharedPtr<ICalendar> ICalendarPtr;
186
187 }
188 }
189 }
190
191 #endif /* _ABSTRACT_LAYER_ICALENDAR_H_ */