summaryrefslogtreecommitdiff
path: root/mobile_src/Calendar/ICalendar.h
blob: 7ac6a93c39c831c90fde091837039241be63ac4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
//
// Tizen Web Device API
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//


#ifndef _ABSTRACT_LAYER_ICALENDAR_H_
#define _ABSTRACT_LAYER_ICALENDAR_H_

#include <string>
#include <sstream>
#include <dpl/shared_ptr.h>
#include "CalendarEvent.h"
#include "IEventAddEvent.h"
#include "IEventAddEvents.h"
#include "IEventDeleteEvent.h"
#include "IEventDeleteEvents.h"
#include "IEventFindEvents.h"
#include "IEventUpdateEvent.h"
#include "IEventUpdateEvents.h"
#include "IEventCreateEventFromString.h"
#include "IEventExportEventToString.h"
#include "IEventWatchChanges.h"
#include "IEventClearWatch.h"
#include "IEventExpandEventRecurrence.h"
#include "IEventGet.h"
#include "OnEventsChanged.h"

namespace DeviceAPI {
namespace Calendar {

class ICalendar : public WrtDeviceApis::Commons::EventRequestReceiver< IEventAddEvent >,
    public WrtDeviceApis::Commons::EventRequestReceiver< IEventAddEvents >,
    public WrtDeviceApis::Commons::EventRequestReceiver< IEventDeleteEvent >,
    public WrtDeviceApis::Commons::EventRequestReceiver< IEventDeleteEvents >,
    public WrtDeviceApis::Commons::EventRequestReceiver< IEventUpdateEvent >,
    public WrtDeviceApis::Commons::EventRequestReceiver< IEventUpdateEvents >,
    public WrtDeviceApis::Commons::EventRequestReceiver< IEventFindEvents >,
    public WrtDeviceApis::Commons::EventRequestReceiver< IEventCreateEventFromString >,
    public WrtDeviceApis::Commons::EventRequestReceiver< IEventExportEventToString >,
    public WrtDeviceApis::Commons::EventRequestReceiver< IEventWatchChanges >,
    public WrtDeviceApis::Commons::EventRequestReceiver< IEventClearWatch >,
    public WrtDeviceApis::Commons::EventRequestReceiver< IEventExpandEventRecurrence >,
    public WrtDeviceApis::Commons::EventRequestReceiver< IEventGet >
{
  public:
    ICalendar();
    virtual ~ICalendar();
    virtual void addEvent(IEventAddEventPtr &event);
    virtual void addEvents(IEventAddEventsPtr &events);
    virtual void updateEvent(IEventUpdateEventPtr &event);
    virtual void updateEvents(IEventUpdateEventsPtr &events);
    virtual void deleteEvent(IEventDeleteEventPtr &event);
    virtual void deleteEvents(IEventDeleteEventsPtr &events);
    virtual void findEvents(IEventFindEventsPtr &event);
    virtual void createEventFromString(IEventCreateEventFromStringPtr &event);
    virtual void exportEventToString(IEventExportEventToStringPtr &event);
    virtual void watchChanges(IEventWatchChangesPtr &event);
    virtual void clearWatch(IEventClearWatchPtr &event);
	virtual void expandEventRecurrence(IEventExpandEventRecurrencePtr &event);
	virtual void get(IEventGetPtr &event);

    virtual std::string getName() const
    {
        return m_name;
    }
    virtual void setName(const std::string &value)
    {
        m_name = value;
    }

    virtual CalendarEvent::CalendarType getType() const
    {
        return m_type;
    }
    virtual void setType(const CalendarEvent::CalendarType value)
    {
        m_type = value;
    }

    virtual std::string getId() const
    {
        return m_id;
    }
    virtual void setId(const int value)
    {
        std::stringstream ss;
        ss<<value;
        m_id = ss.str();
    }

    virtual int getAccountId() const
    {
        return m_accountId;
    }
    virtual void setAccountId(const int value)
    {
        m_accountId = value;
    }

    virtual int getLastChangedVersion()
    {
        return m_lastChangedVersion;
    }
    virtual void setLastChangedVersion(int value)
    {
        m_lastChangedVersion = value;
    }

    virtual bool getIsUnified() const
    {
        return m_isUnified;
    }
    virtual void setIsUnified(const bool value)
    {
        m_isUnified = value;
    }

    OnEventsChangedEmitters m_changeEmitters;

  protected:
	std::string m_id;
	int m_accountId;
	std::string m_name;
	CalendarEvent::CalendarType m_type;
	int m_lastChangedVersion;
	bool m_isUnified;

    virtual void OnRequestReceived(const IEventAddEventPtr &event) = 0;
    virtual void OnRequestReceived(const IEventAddEventsPtr &events) = 0;
    virtual void OnRequestReceived(const IEventDeleteEventPtr &event) = 0;
    virtual void OnRequestReceived(const IEventDeleteEventsPtr &events) = 0;
    virtual void OnRequestReceived(const IEventUpdateEventPtr &event) = 0;
    virtual void OnRequestReceived(const IEventUpdateEventsPtr &events) = 0;
    virtual void OnRequestReceived(const IEventFindEventsPtr &event) = 0;
    virtual void OnRequestReceived(const IEventCreateEventFromStringPtr &event) = 0;
    virtual void OnRequestReceived(const IEventExportEventToStringPtr &event) = 0;
    virtual void OnRequestReceived(const IEventWatchChangesPtr &event) = 0;
    virtual void OnRequestReceived(const IEventClearWatchPtr &event) = 0;
    virtual void OnRequestReceived(const IEventExpandEventRecurrencePtr &event) = 0;
    virtual void OnRequestReceived(const IEventGetPtr &event) = 0;
};

typedef DPL::SharedPtr<ICalendar> ICalendarPtr;

}
}

#endif /* _ABSTRACT_LAYER_ICALENDAR_H_ */