apengine/apeng/src/aplistitemlist.cpp
changeset 61 8b0c979bbe8c
parent 59 2709c04a4af5
child 70 ac5daea24fb0
equal deleted inserted replaced
59:2709c04a4af5 61:8b0c979bbe8c
     1 /*
       
     2 * Copyright (c) 2002 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 *     Declaration of the CApSelect class.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #include "ApListItemList.h"
       
    23 #include "ApListItem.h"
       
    24 #include "ApEngineLogger.h"
       
    25 
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 LOCAL_D const TInt KGranularity = 4;    ///< Granularity of the list.
       
    30 
       
    31 // ================= MEMBER FUNCTIONS =======================
       
    32 
       
    33 // C++ default constructor can NOT contain any code that
       
    34 // might leave.
       
    35 //
       
    36 // ---------------------------------------------------------
       
    37 // CApListItemList::CApListItemList
       
    38 // ---------------------------------------------------------
       
    39 //
       
    40 EXPORT_C CApListItemList::CApListItemList()
       
    41 : CArrayPtrFlat<CApListItem>( KGranularity )
       
    42     {
       
    43     }
       
    44 
       
    45 // Destructor
       
    46 // ---------------------------------------------------------
       
    47 // CApListItemList::~CApListItemList
       
    48 // ---------------------------------------------------------
       
    49 //
       
    50 EXPORT_C CApListItemList::~CApListItemList()
       
    51     {
       
    52     CLOG( ( EApList, 0, _L( "-> CApListItemList::~CApListItemList" ) ) );
       
    53 
       
    54     ResetAndDestroy();
       
    55 
       
    56     CLOG( ( EApList, 1, _L( "<- CApListItemList::~CApListItemList" ) ) );
       
    57     }
       
    58 
       
    59 // ---------------------------------------------------------
       
    60 // CApListItemList::ItemByUid
       
    61 // ---------------------------------------------------------
       
    62 //
       
    63 EXPORT_C CApListItem* CApListItemList::ItemForUid( TUint32 aUid ) const
       
    64     {
       
    65     CLOG( ( EApList, 0, _L( "-> CApListItemList::ItemForUid" ) ) );
       
    66 
       
    67     // This method cannot return "const CApListItem*", because all methods
       
    68     // of CApListItem are non-const -> if the returned item was const, it
       
    69     // would be unusable.
       
    70     TInt i;
       
    71     TInt count = Count();
       
    72     for ( i = 0; i < count; i++ )
       
    73         {
       
    74         if ( At( i )->Uid() == aUid )
       
    75             {
       
    76             return At( i );
       
    77             }
       
    78         }
       
    79 
       
    80     CLOG( ( EApList, 0, _L( "-> CApListItemList::ItemForUid" ) ) );
       
    81     return NULL;
       
    82     }
       
    83 
       
    84 //  End of File