18
|
1 |
/**
|
|
2 |
* Copyright (c) 2010 Sasken Communication Technologies Ltd.
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html"
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
* Manasij Roy, Nalina Hariharan
|
|
14 |
*
|
|
15 |
* Description:
|
|
16 |
* The SmfEvent class represents an event
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
#include <smfevent.h>
|
|
21 |
#include <smfevent_p.h>
|
|
22 |
|
|
23 |
/**
|
|
24 |
* Constructor with default argument
|
|
25 |
*/
|
|
26 |
SmfEvent::SmfEvent( )
|
|
27 |
{
|
|
28 |
d = new SmfEventPrivate;
|
|
29 |
}
|
|
30 |
|
|
31 |
/**
|
|
32 |
* Copy Constructor
|
|
33 |
* @param aOther The reference object
|
|
34 |
*/
|
|
35 |
SmfEvent::SmfEvent( const SmfEvent &aOther )
|
|
36 |
:d( aOther.d )
|
|
37 |
{
|
|
38 |
}
|
|
39 |
|
|
40 |
/**
|
|
41 |
* Overloaded = operator
|
|
42 |
* @param aOther The reference object
|
|
43 |
* @return The target reference value
|
|
44 |
*/
|
|
45 |
SmfEvent& SmfEvent::operator=( const SmfEvent &aOther )
|
|
46 |
{
|
|
47 |
d->m_name = aOther.d->m_name;
|
|
48 |
d->m_dateTime = aOther.d->m_dateTime;
|
|
49 |
d->m_duration = aOther.d->m_duration;
|
|
50 |
d->m_artists = aOther.d->m_artists;
|
|
51 |
d->m_venue = aOther.d->m_venue;
|
|
52 |
d->m_url = aOther.d->m_url;
|
|
53 |
d->m_eventId = aOther.d->m_eventId;
|
|
54 |
return *this;
|
|
55 |
}
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Destructor
|
|
59 |
*/
|
|
60 |
SmfEvent::~SmfEvent( )
|
|
61 |
{
|
|
62 |
}
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Method to get the event name
|
|
66 |
* @return The event name
|
|
67 |
*/
|
|
68 |
QString SmfEvent::title( ) const
|
|
69 |
{
|
|
70 |
return d->m_name;
|
|
71 |
}
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Method to get the event date and time
|
|
75 |
* @return The date and time of the event
|
|
76 |
*/
|
|
77 |
QDateTime SmfEvent::eventDateTime( ) const
|
|
78 |
{
|
|
79 |
return d->m_dateTime;
|
|
80 |
}
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Method to get the event duration
|
|
84 |
* @return The duration of the event
|
|
85 |
*/
|
|
86 |
QTime SmfEvent::duration( ) const
|
|
87 |
{
|
|
88 |
return d->m_duration;
|
|
89 |
}
|
|
90 |
|
|
91 |
/**
|
|
92 |
* Method to get the artist names
|
|
93 |
* @return The list of artists in the event
|
|
94 |
*/
|
|
95 |
SmfArtists SmfEvent::artists( ) const
|
|
96 |
{
|
|
97 |
return d->m_artists;
|
|
98 |
}
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Method to get the venue of the event
|
|
102 |
* @return The venue of the event
|
|
103 |
*/
|
|
104 |
SmfLocation SmfEvent::venue( ) const
|
|
105 |
{
|
|
106 |
return d->m_venue;
|
|
107 |
}
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Method to get the URL for getting tickets for the event
|
|
111 |
* @return The Url for getting ticket for the event
|
|
112 |
*/
|
|
113 |
QUrl SmfEvent::ticketUrl( ) const
|
|
114 |
{
|
|
115 |
return d->m_url;
|
|
116 |
}
|
|
117 |
|
|
118 |
/**
|
|
119 |
* Method to get the id of the event
|
|
120 |
* @return The ID value
|
|
121 |
*/
|
|
122 |
QString SmfEvent::id( ) const
|
|
123 |
{
|
|
124 |
return d->m_eventId;
|
|
125 |
}
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Method to set the event name
|
|
129 |
* @param aName The new event name
|
|
130 |
*/
|
|
131 |
void SmfEvent::setTitle( const QString &aName )
|
|
132 |
{
|
|
133 |
d->m_name = aName;
|
|
134 |
}
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Method to set the event date and time
|
|
138 |
* @param aDateTime The new date and time of the event
|
|
139 |
*
|
|
140 |
*/
|
|
141 |
void SmfEvent::setEventDateTime( const QDateTime &aDateTime )
|
|
142 |
{
|
|
143 |
d->m_dateTime = aDateTime;
|
|
144 |
}
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Method to set the event duration
|
|
148 |
* @param aDuration The new duration of the event
|
|
149 |
*
|
|
150 |
*/
|
|
151 |
void SmfEvent::setDuration( const QTime &aDuration )
|
|
152 |
{
|
|
153 |
d->m_duration = aDuration;
|
|
154 |
}
|
|
155 |
|
|
156 |
/**
|
|
157 |
* Method to set the artist
|
|
158 |
* @param aArtists The new artists in the event
|
|
159 |
*/
|
|
160 |
void SmfEvent::setArtists( const SmfArtists &aArtists )
|
|
161 |
{
|
|
162 |
d->m_artists = aArtists;
|
|
163 |
}
|
|
164 |
|
|
165 |
/**
|
|
166 |
* Method to set the venue name
|
|
167 |
* @param aVenue The new venue of the event
|
|
168 |
*/
|
|
169 |
void SmfEvent::setVenue( const SmfLocation &aVenue )
|
|
170 |
{
|
|
171 |
d->m_venue = aVenue;
|
|
172 |
}
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Method to set the URL for getting tickets for the event
|
|
176 |
* @param aUrl The new Url for getting ticket for the event
|
|
177 |
*/
|
|
178 |
void SmfEvent::setTicketUrl( const QUrl &aUrl )
|
|
179 |
{
|
|
180 |
d->m_url = aUrl;
|
|
181 |
}
|
|
182 |
|
|
183 |
/**
|
|
184 |
* Method to set the id of the event
|
|
185 |
* @param aId The ID value
|
|
186 |
*/
|
|
187 |
void SmfEvent::setId( const QString &aId )
|
|
188 |
{
|
|
189 |
d->m_eventId = aId;
|
|
190 |
}
|
|
191 |
|
|
192 |
|
|
193 |
/**
|
|
194 |
* Method for Externalization. Writes the SmfEvent object to
|
|
195 |
* the stream and returns a reference to the stream.
|
|
196 |
* @param aDataStream Stream to be written
|
|
197 |
* @param aEvent The SmfEvent object to be externalized
|
|
198 |
* @return reference to the written stream
|
|
199 |
*/
|
|
200 |
QDataStream &operator<<( QDataStream &aDataStream,
|
|
201 |
const SmfEvent &aEvent )
|
|
202 |
{
|
|
203 |
// Serialize d->m_name
|
|
204 |
aDataStream<<aEvent.d->m_name;
|
|
205 |
|
|
206 |
// Serialize d->m_dateTime
|
|
207 |
aDataStream<<aEvent.d->m_dateTime;
|
|
208 |
|
|
209 |
// Serialize d->m_duration
|
|
210 |
aDataStream<<aEvent.d->m_duration;
|
|
211 |
|
|
212 |
// Serialize d->m_artists
|
|
213 |
aDataStream<<aEvent.d->m_artists;
|
|
214 |
|
|
215 |
// Serialize d->m_venue
|
|
216 |
aDataStream<<aEvent.d->m_venue;
|
|
217 |
|
|
218 |
// Serialize d->m_url
|
|
219 |
aDataStream<<aEvent.d->m_url;
|
|
220 |
|
|
221 |
// Serialize d->m_eventId
|
|
222 |
aDataStream<<aEvent.d->m_eventId;
|
|
223 |
|
|
224 |
return aDataStream;
|
|
225 |
}
|
|
226 |
|
|
227 |
/**
|
|
228 |
* Method for Internalization. Reads a SmfEvent object from
|
|
229 |
* the stream and returns a reference to the stream.
|
|
230 |
* @param aDataStream Stream to be read
|
|
231 |
* @param aEvent The SmfEvent object to be internalized
|
|
232 |
* @return reference to the stream
|
|
233 |
*/
|
|
234 |
QDataStream &operator>>( QDataStream &aDataStream,
|
|
235 |
SmfEvent &aEvent)
|
|
236 |
{
|
|
237 |
// Deserialize d->m_name
|
|
238 |
aDataStream>>aEvent.d->m_name;
|
|
239 |
|
|
240 |
// Deserialize d->m_dateTime
|
|
241 |
aDataStream>>aEvent.d->m_dateTime;
|
|
242 |
|
|
243 |
// Deserialize d->m_duration
|
|
244 |
aDataStream>>aEvent.d->m_duration;
|
|
245 |
|
|
246 |
// Deserialize d->m_artists
|
|
247 |
aDataStream>>aEvent.d->m_artists;
|
|
248 |
|
|
249 |
// Deserialize d->m_venue
|
|
250 |
aDataStream>>aEvent.d->m_venue;
|
|
251 |
|
|
252 |
// Deserialize d->m_url
|
|
253 |
aDataStream>>aEvent.d->m_url;
|
|
254 |
|
|
255 |
// Deserialize d->m_eventId
|
|
256 |
aDataStream>>aEvent.d->m_eventId;
|
|
257 |
|
|
258 |
return aDataStream;
|
|
259 |
}
|