Beta merge 2
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / Calendar / CalendarEvent.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_CALENDAR_EVENT_H_
19 #define _ABSTRACT_LAYER_CALENDAR_EVENT_H_
20
21 #include <ctime>
22 #include <string>
23 #include <vector>
24 #include <dpl/optional.h>
25 #include <dpl/shared_ptr.h>
26
27 #include "CalendarItemGeo.h"
28 #include "EventAttendee.h"
29 #include "EventRecurrenceRule.h"
30
31 namespace TizenApis {
32 namespace Api {
33 namespace Calendar {
34
35 typedef std::vector<std::string> CategoryList;
36 typedef DPL::SharedPtr<CategoryList> CategoryListPtr;
37
38 typedef std::vector<std::string> AttributeList;
39 typedef DPL::SharedPtr<AttributeList> AttributeListPtr;
40
41 /* This object represents a single calendar event */
42 class CalendarEvent
43 {
44   public:
45
46     static const int UNDEFINED_CALENDAR_ID = -1;
47
48     typedef enum
49     {
50         TENTATIVE_STATUS,
51         CONFIRMED_STATUS,
52         CANCELLED_STATUS,
53         NEEDS_ACTION_STATUS,
54         IN_PROCESS_STATUS,
55         COMPLETED_STATUS,
56         INVALID_STATUS = 10000,
57         UNDEFINED_STATUS
58     } EventStatus;
59
60     typedef enum
61     {
62         NO_ALARM,
63         SILENT_ALARM,
64         SOUND_ALARM,
65         INVALID_ALARM_TYPE = 10000,
66         UNDEFINED_ALARM_TYPE
67     } EventAlarmType;
68
69     typedef enum
70     {
71         PUBLIC_VISIBILITY,
72         PRIVATE_VISIBILITY,
73         CONFIDENTIAL_VISIBILITY,
74         INVALID_VISIBILITY = 10000,
75         UNDEFINED_VISIBILITY
76     } EventVisibility;
77
78     typedef enum
79     {
80         BUSY_FB,
81         BUSY_UNAVAILABLE_FB,
82         FREE_FB,
83         BUSY_TENTATIVE_FB,
84         INVALID_AVAILABILITY = 10000,
85         UNDEFINED_AVAILABILITY
86     } EventAvailability;
87
88     typedef enum
89     {
90         LOW_PRIORITY,
91         MEDIUM_PRIORITY,
92         HIGH_PRIORITY,
93         INVALID_PRIORITY = 10000,
94         UNDEFINED_PRIORITY
95     } TaskPriority;
96
97     typedef enum
98     {
99         ICALENDAR_20,
100         VCALENDAR_10,
101         INVALID_FORMAT = 10000,
102         UNDEFINED_FORMAT
103     } VObjectFormat;
104
105     typedef enum
106     {
107         EVENT_TYPE = 0,
108         TASK_TYPE,
109     } CalendarType;
110
111
112     CalendarEvent();
113     CalendarEvent(const CalendarEvent &original); // copy constructor for clone operation
114     virtual ~CalendarEvent();
115
116     int getId() const;
117     void setId(int value);
118     void resetId();
119     bool getIdIsSet() const;
120
121     int getCalendarId() const;
122     void setCalendarId(int value);
123
124     std::string getDescription() const;
125     void setDescription(const std::string &value);
126
127     std::string getSubject() const;
128     void setSubject(const std::string &value);
129
130     std::time_t getStartTime() const;
131     void setStartTime(std::time_t value);
132
133     std::time_t getEndTime() const;
134     void setEndTime(std::time_t value);
135
136     std::string getLocation() const;
137     void setLocation(const std::string &value);
138
139     EventRecurrenceRulePtr getRecurrenceRule() const;
140     void setRecurrenceRule(EventRecurrenceRulePtr value);
141
142     EventStatus getStatus() const;
143     void setStatus(EventStatus value);
144
145     std::vector<long> getAlarmsTick() const;
146     void setAlarmsTick(std::vector<long> &value);
147
148     std::vector<EventAlarmType> getAlarmsType() const;
149     void setAlarmsType(std::vector<EventAlarmType> &value);
150
151     std::vector<std::string> getAlarmsDescription() const;
152     void setAlarmsDescription(std::vector<std::string> &value);
153
154     CategoryListPtr getCategories() const;
155     void setCategories(const CategoryListPtr &value);
156
157     void display() const;
158     bool validate() const;
159
160     bool getIsAllDay() const;
161     void setIsAllDay(bool value);
162
163     std::time_t getLastModifiedDate() const;
164     void setLastModifiedDate(std::time_t value);
165
166     std::string getOrganizer() const;
167     void setOrganizer(const std::string &value);
168
169     EventVisibility getVisibility() const;
170     void setVisibility(EventVisibility value);
171
172     EventAvailability getAvailability() const;
173     void setAvailability(EventAvailability value);
174
175     std::string getUId() const;
176     void setUId(const std::string &value);
177
178     std::time_t getRecurrenceId() const;
179     void setRecurrenceId(std::time_t value);
180
181     EventAttendeeListPtr getAttendees() const;
182     void setAttendees(const EventAttendeeListPtr &value);
183
184     bool getIsDetached() const;
185     void setIsDetached(bool value);
186
187     void setAttributesOfInterest(AttributeListPtr value);
188     AttributeListPtr getAttributesOfInterest() const;
189
190     void setGeolocation(CalendarItemGeoPtr value);
191     CalendarItemGeoPtr getGeolocation() const;
192
193     void setTimeZone(std::string value);
194     std::string getTimeZone() const;
195
196     TaskPriority getPriority() const;
197     void setPriority(TaskPriority value);
198
199     std::time_t getCreatedDate() const;
200     void setCreatedDate(std::time_t value);
201
202     std::time_t getCompletedDate() const;
203     void setCompletedDate(std::time_t value);
204
205     int getProgress() const;
206     void setProgress(int value);
207
208     CalendarType getCalendarType() const;
209     void setCalendarType(CalendarType type);
210
211   protected:
212     DPL::Optional<int> m_id;
213     int m_calendarId;
214     std::string m_description;
215     std::string m_subject;
216     std::time_t m_startTime;
217     std::time_t m_endTime;
218     std::string m_location;
219     EventRecurrenceRulePtr m_recurrence;
220     EventStatus m_status;
221     std::vector<long> m_alarmsTick;
222     std::vector<EventAlarmType> m_alarmsType;
223     std::vector<std::string> m_alarmsDescription;
224     CategoryListPtr m_categories;
225     bool m_isAllDay;
226     std::string m_organizer;
227     std::time_t m_lastModifiedDate;
228     EventVisibility m_visibility;
229     EventAvailability m_availability;
230     std::string m_uid;
231     std::time_t m_recurrenceId;
232     EventAttendeeListPtr m_attendees;
233     bool m_isDetached;
234     AttributeListPtr m_attributesOfInterest;
235     CalendarItemGeoPtr m_geolocation;
236     std::string m_timeZone;
237     TaskPriority m_priority;
238     std::time_t m_createdDate;
239     std::time_t m_completedDate;
240     int m_progress;
241     CalendarType m_calendarType;
242 };
243
244 typedef DPL::SharedPtr<CalendarEvent> CalendarEventPtr;
245 typedef std::vector<CalendarEventPtr> CalendarEventList;
246 typedef DPL::SharedPtr<CalendarEventList> CalendarEventListPtr;
247
248 }
249 }
250 }
251
252 #endif /* _ABSTRACT_LAYER_CALENDAR_EVENT_H_ */
253