|
1 /* |
|
2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Capsulating fill and store file lists |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #include <e32std.h> |
|
24 #include "cmsqlitemresource.h" |
|
25 #include "cmsqlgenericitem.h" |
|
26 #include "msdebug.h" |
|
27 |
|
28 // ======== LOCAL FUNCTIONS ======== |
|
29 // --------------------------------------------------------------------------- |
|
30 // NewL |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 EXPORT_C CCmSqlGenericItem* CCmSqlGenericItem::NewL() |
|
34 { |
|
35 CCmSqlGenericItem* self = CCmSqlGenericItem::NewLC(); |
|
36 CleanupStack::Pop( self ); |
|
37 return self; |
|
38 } |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // NewLC |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 EXPORT_C CCmSqlGenericItem* CCmSqlGenericItem::NewLC() |
|
45 { |
|
46 CCmSqlGenericItem* self = new ( ELeave ) CCmSqlGenericItem(); |
|
47 CleanupStack::PushL( self ); |
|
48 self->ConstructL(); |
|
49 return self; |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // Destructor |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 EXPORT_C CCmSqlGenericItem::~CCmSqlGenericItem() |
|
57 { |
|
58 delete iTitle; |
|
59 delete iUri; |
|
60 |
|
61 iResources.ResetAndDestroy(); |
|
62 iResources.Close(); |
|
63 } |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // CCmSqlGenericItem::SetSize |
|
67 // --------------------------------------------------------------------------- |
|
68 // |
|
69 EXPORT_C void CCmSqlGenericItem::SetSize( const TInt aSize ) |
|
70 { |
|
71 iSize = aSize; |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // CCmSqlGenericItem::SetTitleL |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 EXPORT_C void CCmSqlGenericItem::SetTitleL( const TDesC8& aTitle ) |
|
79 { |
|
80 delete iTitle; |
|
81 iTitle = NULL; |
|
82 |
|
83 if( &aTitle ) |
|
84 { |
|
85 iTitle = aTitle.AllocL(); |
|
86 } |
|
87 else |
|
88 { |
|
89 iTitle = KNullDesC8().AllocL(); |
|
90 } |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // CCmSqlGenericItem::SetDate |
|
95 // --------------------------------------------------------------------------- |
|
96 // |
|
97 EXPORT_C void CCmSqlGenericItem::SetDate( const TTime& aDate ) |
|
98 { |
|
99 iDate = aDate; |
|
100 } |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // CCmSqlGenericItem::SetHarvestDate |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 EXPORT_C void CCmSqlGenericItem::SetHarvestDate( const TTime& aHarvestDate ) |
|
107 { |
|
108 iHarvestDate = aHarvestDate; |
|
109 } |
|
110 |
|
111 // --------------------------------------------------------------------------- |
|
112 // CCmSqlGenericItem::SetUpnpclassId |
|
113 // --------------------------------------------------------------------------- |
|
114 // |
|
115 EXPORT_C void CCmSqlGenericItem::SetUpnpclassId( const TInt64 aUpnpclassId ) |
|
116 { |
|
117 iUpnpclassId = aUpnpclassId; |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------------------------- |
|
121 // CCmSqlGenericItem::SetUpnpProfileId |
|
122 // --------------------------------------------------------------------------- |
|
123 // |
|
124 EXPORT_C void CCmSqlGenericItem::SetUpnpProfileId( |
|
125 const TInt64 aUpnpProfileId ) |
|
126 { |
|
127 iUpnpProfileId = aUpnpProfileId; |
|
128 } |
|
129 |
|
130 // --------------------------------------------------------------------------- |
|
131 // CCmSqlGenericItem::SetUriL |
|
132 // --------------------------------------------------------------------------- |
|
133 // |
|
134 EXPORT_C void CCmSqlGenericItem::SetUriL( const TDesC8& aUri ) |
|
135 { |
|
136 delete iUri; |
|
137 iUri = NULL; |
|
138 |
|
139 if( &aUri ) |
|
140 { |
|
141 iUri = aUri.AllocL(); |
|
142 } |
|
143 else |
|
144 { |
|
145 iUri = KNullDesC8().AllocL(); |
|
146 } |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------------------------- |
|
150 // CCmSqlGenericItem::SetMediaType |
|
151 // --------------------------------------------------------------------------- |
|
152 // |
|
153 EXPORT_C void CCmSqlGenericItem::SetMediaType( const TCmMediaType aMType ) |
|
154 { |
|
155 iMType = aMType; |
|
156 } |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // CCmSqlGenericItem::NewResourceL |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 EXPORT_C void CCmSqlGenericItem::NewResourceL( const TDesC8& aUri, |
|
163 const TInt aSize, const TInt aDuration, const TInt aBitrate, |
|
164 const TInt64 aResolutionId ) |
|
165 { |
|
166 CCmSqlItemResource* item = CCmSqlItemResource::NewLC( |
|
167 aUri, aSize, aDuration, aBitrate, aResolutionId ); |
|
168 iResources.Append( item ); |
|
169 CleanupStack::Pop( item ); |
|
170 } |
|
171 |
|
172 // --------------------------------------------------------------------------- |
|
173 // CCmSqlGenericItem::Size |
|
174 // --------------------------------------------------------------------------- |
|
175 // |
|
176 EXPORT_C TInt CCmSqlGenericItem::Size() const |
|
177 { |
|
178 return iSize; |
|
179 } |
|
180 |
|
181 // --------------------------------------------------------------------------- |
|
182 // CCmSqlGenericItem::Title |
|
183 // --------------------------------------------------------------------------- |
|
184 // |
|
185 EXPORT_C TDesC8& CCmSqlGenericItem::Title() const |
|
186 { |
|
187 return *iTitle; |
|
188 } |
|
189 |
|
190 // --------------------------------------------------------------------------- |
|
191 // CCmSqlGenericItem::Date |
|
192 // --------------------------------------------------------------------------- |
|
193 // |
|
194 EXPORT_C TTime CCmSqlGenericItem::Date() const |
|
195 { |
|
196 return iDate; |
|
197 } |
|
198 |
|
199 // --------------------------------------------------------------------------- |
|
200 // CCmSqlGenericItem::HarvestDate |
|
201 // --------------------------------------------------------------------------- |
|
202 // |
|
203 EXPORT_C TTime CCmSqlGenericItem::HarvestDate() const |
|
204 { |
|
205 return iHarvestDate; |
|
206 } |
|
207 |
|
208 // --------------------------------------------------------------------------- |
|
209 // CCmSqlGenericItem::UpnpclassId |
|
210 // --------------------------------------------------------------------------- |
|
211 // |
|
212 EXPORT_C TInt64 CCmSqlGenericItem::UpnpclassId() const |
|
213 { |
|
214 return iUpnpclassId; |
|
215 } |
|
216 |
|
217 // --------------------------------------------------------------------------- |
|
218 // CCmSqlGenericItem::UpnpProfileId |
|
219 // --------------------------------------------------------------------------- |
|
220 // |
|
221 EXPORT_C TInt64 CCmSqlGenericItem::UpnpProfileId() const |
|
222 { |
|
223 return iUpnpProfileId; |
|
224 } |
|
225 |
|
226 // --------------------------------------------------------------------------- |
|
227 // CCmSqlGenericItem::Uri |
|
228 // --------------------------------------------------------------------------- |
|
229 // |
|
230 EXPORT_C TDesC8& CCmSqlGenericItem::Uri() const |
|
231 { |
|
232 return *iUri; |
|
233 } |
|
234 |
|
235 // --------------------------------------------------------------------------- |
|
236 // CCmSqlGenericItem::MediaType |
|
237 // --------------------------------------------------------------------------- |
|
238 // |
|
239 EXPORT_C TCmMediaType CCmSqlGenericItem::MediaType() const |
|
240 { |
|
241 return iMType; |
|
242 } |
|
243 |
|
244 // --------------------------------------------------------------------------- |
|
245 // CCmSqlGenericItem::ResourceCount |
|
246 // --------------------------------------------------------------------------- |
|
247 // |
|
248 EXPORT_C TInt CCmSqlGenericItem::ResourceCount() const |
|
249 { |
|
250 return iResources.Count(); |
|
251 } |
|
252 |
|
253 // --------------------------------------------------------------------------- |
|
254 // CCmSqlGenericItem::GetResource |
|
255 // --------------------------------------------------------------------------- |
|
256 // |
|
257 EXPORT_C void CCmSqlGenericItem::GetResource( TDesC8& aUri, TInt& aSize, |
|
258 TInt& aDuration, TInt& aBitrate, TInt64& aResolutionId, TInt aIndex ) |
|
259 { |
|
260 if( aIndex < iResources.Count() ) |
|
261 { |
|
262 aUri = iResources[aIndex]->Uri(); |
|
263 aSize = iResources[aIndex]->Size(); |
|
264 aDuration = iResources[aIndex]->Duration(); |
|
265 aBitrate = iResources[aIndex]->Bitrate(); |
|
266 aResolutionId = iResources[aIndex]->ResolutionId(); |
|
267 } |
|
268 } |
|
269 |
|
270 // --------------------------------------------------------------------------- |
|
271 // Default constructor |
|
272 // --------------------------------------------------------------------------- |
|
273 // |
|
274 CCmSqlGenericItem::CCmSqlGenericItem() |
|
275 { |
|
276 } |
|
277 |
|
278 // --------------------------------------------------------------------------- |
|
279 // ConstructL |
|
280 // --------------------------------------------------------------------------- |
|
281 // |
|
282 void CCmSqlGenericItem::ConstructL() |
|
283 { |
|
284 iUri = KNullDesC8().AllocL(); |
|
285 iTitle = KNullDesC8().AllocL(); |
|
286 } |
|
287 |
|
288 // End of file |
|
289 |