|
1 /* |
|
2 * Copyright (c) 2006 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: Implementation of CDestListItemList |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "destlistitemlist.h" |
|
19 #include "destlistitem.h" |
|
20 |
|
21 LOCAL_D const TInt KGranularity = 4; ///< Granularity of the list. |
|
22 |
|
23 // --------------------------------------------------------- |
|
24 // CDestListItemList::CDestListItemList |
|
25 // --------------------------------------------------------- |
|
26 // |
|
27 CDestListItemList::CDestListItemList() |
|
28 : CArrayPtrFlat<CDestListItem>( KGranularity ) |
|
29 { |
|
30 } |
|
31 |
|
32 // --------------------------------------------------------- |
|
33 // CDestListItemList::~CDestListItemList |
|
34 // --------------------------------------------------------- |
|
35 // |
|
36 CDestListItemList::~CDestListItemList() |
|
37 { |
|
38 ResetAndDestroy(); |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------- |
|
42 // CDestListItemList::ItemByUid |
|
43 // --------------------------------------------------------- |
|
44 // |
|
45 CDestListItem* CDestListItemList::ItemForUid( TUint32 aUid ) const |
|
46 { |
|
47 // This method cannot return "const CDestListItem*", because all methods |
|
48 // of CDestListItem are non-const -> if the returned item was const, it |
|
49 // would be unusable. |
|
50 TInt i; |
|
51 TInt count = Count(); |
|
52 for ( i = 0; i < count; i++ ) |
|
53 { |
|
54 if ( At( i )->Uid() == aUid ) |
|
55 { |
|
56 return At( i ); |
|
57 } |
|
58 } |
|
59 |
|
60 return NULL; |
|
61 } |