|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 // CBlacklistItem |
|
18 |
|
19 #include "blacklistitem.h" |
|
20 #include "mdsutils.h" |
|
21 #include "mdcserializationbuffer.h" |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // Standard NewL for CBlacklistItem |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 CBlacklistItem* CBlacklistItem::NewL( const TInt64& aModified, const TDesC& aUri, |
|
28 const TUint32 aMediaId ) |
|
29 { |
|
30 CBlacklistItem* self = new (ELeave) CBlacklistItem( aModified, aMediaId ); |
|
31 CleanupStack::PushL( self ); |
|
32 self->ConstructL( aUri ); |
|
33 CleanupStack::Pop( self ); |
|
34 return self; |
|
35 } |
|
36 |
|
37 // --------------------------------------------------------------------------- |
|
38 // ConstructL() |
|
39 // 2nd phase construction. |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 void CBlacklistItem::ConstructL( const TDesC& aUri ) |
|
43 { |
|
44 iUri = aUri.AllocL(); |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CBlacklistItem::~CBlacklistItem() |
|
52 { |
|
53 delete iUri; |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // Constructor for CBlacklistItem |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 CBlacklistItem::CBlacklistItem( const TInt64& aModified, |
|
61 const TUint32 aMediaId ) |
|
62 : iModified( aModified ), iUri( NULL ), iMediaId( aMediaId ) |
|
63 { |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // Search a file from blacklist cache. |
|
68 // --------------------------------------------------------------------------- |
|
69 // |
|
70 TBool CBlacklistItem::Compare( const TDesC& aUri, const TUint32 aMediaId ) |
|
71 { |
|
72 if ( iUri && MdsUtils::Compare( *iUri, aUri ) == 0 && iMediaId == aMediaId ) |
|
73 { |
|
74 return ETrue; |
|
75 } |
|
76 return EFalse; |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // Returns item's last modification time. |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 const TInt64& CBlacklistItem::Modified() |
|
84 { |
|
85 return iModified; |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // Returns item's MediaId. |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 const TUint32& CBlacklistItem::MediaId() |
|
93 { |
|
94 return iMediaId; |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // Returns item's Uri. |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 const HBufC* CBlacklistItem::Uri() |
|
102 { |
|
103 return iUri; |
|
104 } |
|
105 // --------------------------------------------------------------------------- |
|
106 // Returns item's Uri. |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 TInt CBlacklistItem::RequiredBufferSize() |
|
110 { |
|
111 return ( CMdCSerializationBuffer::KRequiredSizeForTInt64 + |
|
112 CMdCSerializationBuffer::KRequiredSizeForTUint32 + |
|
113 CMdCSerializationBuffer::RequiredSize( *iUri ) ); |
|
114 } |
|
115 |
|
116 // End of file |