cmmanager/cmmgr/Framework/Src/cmlistitemlist.cpp
branchRCL_3
changeset 58 83ca720e2b9a
parent 0 5a93021fdf25
equal deleted inserted replaced
57:05bc53fe583b 58:83ca720e2b9a
       
     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 CCmListItemList
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cmlistitemlist.h"
       
    19 #include "cmlistitem.h"
       
    20 
       
    21 
       
    22 LOCAL_D const TInt KGranularity = 4;    ///< Granularity of the list.
       
    23 
       
    24 // ---------------------------------------------------------
       
    25 // CCmListItemList::CCmListItemList
       
    26 // ---------------------------------------------------------
       
    27 //
       
    28 CCmListItemList::CCmListItemList()
       
    29     : CArrayPtrFlat<CCmListItem>( KGranularity )
       
    30     {
       
    31     }
       
    32 
       
    33 // ---------------------------------------------------------
       
    34 // CCmListItemList::~CCmListItemList
       
    35 // ---------------------------------------------------------
       
    36 //
       
    37 CCmListItemList::~CCmListItemList()
       
    38     {
       
    39     ResetAndDestroy();
       
    40     }
       
    41 
       
    42 // ---------------------------------------------------------
       
    43 // CCmListItemList::ItemForUid
       
    44 // ---------------------------------------------------------
       
    45 //
       
    46 CCmListItem* CCmListItemList::ItemForUid( TUint32 aUid ) const
       
    47     {
       
    48     // This method cannot return "const CCmListItem*", because all methods
       
    49     // of CCmListItem are non-const -> if the returned item was const, it
       
    50     // would be unusable.
       
    51     TInt i;
       
    52     TInt count = Count();
       
    53     for ( i = 0; i < count; i++ )
       
    54         {
       
    55         if ( At( i )->Uid() == aUid )
       
    56             {
       
    57             return At( i );
       
    58             }
       
    59         }
       
    60 
       
    61     return NULL;
       
    62     }