tizen beta release
[framework/web/wrt-plugins-common.git] / src / modules / tizen / Calendar / EventWrapper.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  * @file        EventWrapper.h
18  * @author      Lukasz Marek (l.marek@samsung.com)
19  * @version     0.1
20  */
21
22 #ifndef WRTDEVICEAPIS_CALENDAR_EVENT_WRAPPER_H_
23 #define WRTDEVICEAPIS_CALENDAR_EVENT_WRAPPER_H_
24
25 #include <string>
26 #include <calendar-svc-provider.h>
27 #include <dpl/shared_ptr.h>
28 #include <Calendar/CalendarEvent.h>
29 #include <Calendar/EventFilter.h>
30
31 namespace WrtDeviceApis {
32 namespace Calendar {
33
34 class EventWrapper
35 {
36   public:
37     EventWrapper();
38     explicit EventWrapper(const Api::CalendarEventPtr &event);
39     virtual ~EventWrapper();
40     cal_struct *convertAbstractEventToPlatformEvent();
41     Api::CalendarEventPtr convertPlatformEventToAbstractEvent();
42     cal_struct *getPlatformEvent() const;
43     Api::CalendarEventPtr getAbstractEvent() const;
44     void freePlatformEvent();
45     void saveEvent();
46     void loadEvent(int id);
47     void deleteEvent();
48     bool matchFilters(Api::EventFilterPtr filter);
49
50   protected:
51     int  getIDFromPlatformEvent() const;
52     void setDescriptionToPlatformEvent();
53     void setSubjectToPlatformEvent();
54     void setStartTimeToPlatformEvent();
55     void setEndTimeToPlatformEvent();
56     void setLocationToPlatformEvent();
57     void setRecurrenceToPlatformEvent();
58     void setAlarmToPlatformEvent();
59     void setStatusToPlatformEvent();
60     void setCategoriesToPlatformEvent();
61     void setIDToPlatformEvent();
62     void setExpiresToPlatformEvent();
63     void setIntervalToPlatformEvent();
64
65     void setDescriptionFromPlatformEvent();
66     void setSubjectFromPlatformEvent();
67     void setStartTimeFromPlatformEvent();
68     void setEndTimeFromPlatformEvent();
69     void setLocationFromPlatformEvent();
70     void setRecurrenceFromPlatformEvent();
71     void setAlarmFromPlatformEvent();
72     void setStatusFromPlatformEvent();
73     void setCategoriesFromPlatformEvent();
74     void setIDFromPlatformEvent();
75     void setExpiresFromPlatformEvent();
76     void setIntervalFromPlatformEvent();
77   private:
78     void displayAbstractEvent();     //only for debugging
79     void displayPlatformEvent();     //only for debugging
80
81     cal_struct *m_platformEvent;
82     Api::CalendarEventPtr m_abstractEvent;
83 };
84
85 typedef DPL::SharedPtr<EventWrapper> EventWrapperPtr;
86 }
87 }
88 #endif // WRTDEVICEAPIS_CALENDAR_EVENT_WRAPPER_H_