1 /* |
|
2 * Copyright (c) 2007-2009 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: Client harvest item implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "clientharvestitem.h" |
|
20 #include "harvesterlog.h" |
|
21 |
|
22 // --------------------------------------------------------------------------- |
|
23 // Constructor |
|
24 // --------------------------------------------------------------------------- |
|
25 // |
|
26 RClientHarvestItem::RClientHarvestItem() |
|
27 { |
|
28 WRITELOG( "RClientHarvestItem::RClientHarvestItem()" ); |
|
29 iUri = NULL; |
|
30 } |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // Copy constructor |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 RClientHarvestItem::RClientHarvestItem( const RClientHarvestItem& aItem ) |
|
37 { |
|
38 iUri = aItem.iUri; |
|
39 iTimeStamp = aItem.iTimeStamp; |
|
40 const TInt count = aItem.iAlbumIds.Count(); |
|
41 iAlbumIds.Reserve( count ); |
|
42 for ( TInt i = 0; i < count; i++ ) |
|
43 { |
|
44 iAlbumIds.Append( aItem.iAlbumIds[i] ); |
|
45 } |
|
46 } |
|
47 |
|
48 // --------------------------------------------------------------------------- |
|
49 // InitL |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 void RClientHarvestItem::InitL( const TDesC& aUri, RArray<TItemId>& aAlbumIds ) |
|
53 { |
|
54 if ( aUri.Length() <= 0 || aUri.Length() > KMaxFileName ) |
|
55 { |
|
56 User::Leave( KErrArgument ); |
|
57 } |
|
58 |
|
59 this->Reset(); |
|
60 |
|
61 iTimeStamp.UniversalTime(); |
|
62 iUri = aUri.AllocL(); |
|
63 const TInt count = aAlbumIds.Count(); |
|
64 |
|
65 iAlbumIds.Reserve( count ); |
|
66 for ( TInt i = 0; i < count; i++ ) |
|
67 { |
|
68 iAlbumIds.Append( aAlbumIds[i] ); |
|
69 } |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // Reset |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 void RClientHarvestItem::Reset() |
|
77 { |
|
78 if ( iUri ) |
|
79 { |
|
80 delete iUri; |
|
81 iUri = NULL; |
|
82 } |
|
83 |
|
84 iAlbumIds.Reset(); |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // Close |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 void RClientHarvestItem::Close() |
|
92 { |
|
93 Reset(); |
|
94 iAlbumIds.Close(); |
|
95 } |
|
96 |
|
97 |
|
98 |
|
99 |
|