wrt-plugins-tizen_0.4.23
[framework/web/wrt-plugins-tizen.git] / src / Calendar / ICalendar.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18
19 #ifndef _ABSTRACT_LAYER_ICALENDAR_H_
20 #define _ABSTRACT_LAYER_ICALENDAR_H_
21
22 #include <string>
23 #include <sstream>
24 #include <dpl/shared_ptr.h>
25 #include "CalendarEvent.h"
26 #include "IEventAddEvent.h"
27 #include "IEventAddEvents.h"
28 #include "IEventDeleteEvent.h"
29 #include "IEventDeleteEvents.h"
30 #include "IEventFindEvents.h"
31 #include "IEventUpdateEvent.h"
32 #include "IEventUpdateEvents.h"
33 #include "IEventCreateEventFromString.h"
34 #include "IEventExportEventToString.h"
35 #include "IEventWatchChanges.h"
36 #include "IEventClearWatch.h"
37 #include "IEventExpandEventRecurrence.h"
38 #include "IEventGet.h"
39 #include "OnEventsChanged.h"
40
41 namespace DeviceAPI {
42 namespace Calendar {
43
44 class ICalendar : public WrtDeviceApis::Commons::EventRequestReceiver< IEventAddEvent >,
45     public WrtDeviceApis::Commons::EventRequestReceiver< IEventAddEvents >,
46     public WrtDeviceApis::Commons::EventRequestReceiver< IEventDeleteEvent >,
47     public WrtDeviceApis::Commons::EventRequestReceiver< IEventDeleteEvents >,
48     public WrtDeviceApis::Commons::EventRequestReceiver< IEventUpdateEvent >,
49     public WrtDeviceApis::Commons::EventRequestReceiver< IEventUpdateEvents >,
50     public WrtDeviceApis::Commons::EventRequestReceiver< IEventFindEvents >,
51     public WrtDeviceApis::Commons::EventRequestReceiver< IEventCreateEventFromString >,
52     public WrtDeviceApis::Commons::EventRequestReceiver< IEventExportEventToString >,
53     public WrtDeviceApis::Commons::EventRequestReceiver< IEventWatchChanges >,
54     public WrtDeviceApis::Commons::EventRequestReceiver< IEventClearWatch >,
55     public WrtDeviceApis::Commons::EventRequestReceiver< IEventExpandEventRecurrence >,
56     public WrtDeviceApis::Commons::EventRequestReceiver< IEventGet >
57 {
58   public:
59     ICalendar();
60     virtual ~ICalendar();
61     virtual void addEvent(IEventAddEventPtr &event);
62     virtual void addEvents(IEventAddEventsPtr &events);
63     virtual void updateEvent(IEventUpdateEventPtr &event);
64     virtual void updateEvents(IEventUpdateEventsPtr &events);
65     virtual void deleteEvent(IEventDeleteEventPtr &event);
66     virtual void deleteEvents(IEventDeleteEventsPtr &events);
67     virtual void findEvents(IEventFindEventsPtr &event);
68     virtual void createEventFromString(IEventCreateEventFromStringPtr &event);
69     virtual void exportEventToString(IEventExportEventToStringPtr &event);
70     virtual void watchChanges(IEventWatchChangesPtr &event);
71     virtual void clearWatch(IEventClearWatchPtr &event);
72         virtual void expandEventRecurrence(IEventExpandEventRecurrencePtr &event);
73         virtual void get(IEventGetPtr &event);
74
75     virtual std::string getName() const
76     {
77         return m_name;
78     }
79     virtual void setName(const std::string &value)
80     {
81         m_name = value;
82     }
83
84     virtual CalendarEvent::CalendarType getType() const
85     {
86         return m_type;
87     }
88     virtual void setType(const CalendarEvent::CalendarType value)
89     {
90         m_type = value;
91     }
92
93     virtual std::string getId() const
94     {
95         return m_id;
96     }
97     virtual void setId(const int value)
98     {
99         std::stringstream ss;
100         ss<<value;
101         m_id = ss.str();
102     }
103
104     virtual int getAccountId() const
105     {
106         return m_accountId;
107     }
108     virtual void setAccountId(const int value)
109     {
110         m_accountId = value;
111     }
112
113     virtual int getLastChangedVersion()
114     {
115         return m_lastChangedVersion;
116     }
117     virtual void setLastChangedVersion(int value)
118     {
119         m_lastChangedVersion = value;
120     }
121
122     virtual bool getIsUnified() const
123     {
124         return m_isUnified;
125     }
126     virtual void setIsUnified(const bool value)
127     {
128         m_isUnified = value;
129     }
130
131     OnEventsChangedEmitters m_changeEmitters;
132
133   protected:
134         std::string m_id;
135         int m_accountId;
136         std::string m_name;
137         CalendarEvent::CalendarType m_type;
138         int m_lastChangedVersion;
139         bool m_isUnified;
140
141     virtual void OnRequestReceived(const IEventAddEventPtr &event) = 0;
142     virtual void OnRequestReceived(const IEventAddEventsPtr &events) = 0;
143     virtual void OnRequestReceived(const IEventDeleteEventPtr &event) = 0;
144     virtual void OnRequestReceived(const IEventDeleteEventsPtr &events) = 0;
145     virtual void OnRequestReceived(const IEventUpdateEventPtr &event) = 0;
146     virtual void OnRequestReceived(const IEventUpdateEventsPtr &events) = 0;
147     virtual void OnRequestReceived(const IEventFindEventsPtr &event) = 0;
148     virtual void OnRequestReceived(const IEventCreateEventFromStringPtr &event) = 0;
149     virtual void OnRequestReceived(const IEventExportEventToStringPtr &event) = 0;
150     virtual void OnRequestReceived(const IEventWatchChangesPtr &event) = 0;
151     virtual void OnRequestReceived(const IEventClearWatchPtr &event) = 0;
152     virtual void OnRequestReceived(const IEventExpandEventRecurrencePtr &event) = 0;
153     virtual void OnRequestReceived(const IEventGetPtr &event) = 0;
154 };
155
156 typedef DPL::SharedPtr<ICalendar> ICalendarPtr;
157
158 }
159 }
160
161 #endif /* _ABSTRACT_LAYER_ICALENDAR_H_ */