browserutilities/favouritesengine/ClientServer/srvsrc/FavouritesItemImplList.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2004 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 the License "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 *      Implementation of CFavouritesItemImplList.
       
    16 *      
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include <s32strm.h>
       
    24 #include "FavouritesItemImplList.h"
       
    25 #include "FavouritesItemImpl.h"
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 /// Granularity of the item list.
       
    30 LOCAL_D const TInt KGranularity = 8;
       
    31 
       
    32 // ================= MEMBER FUNCTIONS =======================
       
    33 
       
    34 // ---------------------------------------------------------
       
    35 // CFavouritesItemImplList::CFavouritesItemImplList
       
    36 // ---------------------------------------------------------
       
    37 //
       
    38 CFavouritesItemImplList::CFavouritesItemImplList()
       
    39 : CArrayPtrFlat<CFavouritesItemImpl>( KGranularity )
       
    40     {
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------
       
    44 // CFavouritesItemImplList::~CFavouritesItemImplList
       
    45 // ---------------------------------------------------------
       
    46 //
       
    47 CFavouritesItemImplList::~CFavouritesItemImplList()
       
    48     {
       
    49     ResetAndDestroy();
       
    50     }
       
    51 
       
    52 // ---------------------------------------------------------
       
    53 // CFavouritesItemImplList::ExternalizeL
       
    54 // ---------------------------------------------------------
       
    55 //
       
    56 void CFavouritesItemImplList::ExternalizeL( RWriteStream& aStream ) const
       
    57     {
       
    58     aStream.WriteInt32L( Count() );
       
    59     for ( TInt i = 0; i < Count(); i++ )
       
    60         {
       
    61         At( i )->ExternalizeL( aStream );
       
    62         }
       
    63     }
       
    64 
       
    65 // ---------------------------------------------------------
       
    66 // CFavouritesItemImplList::InternalizeL
       
    67 // ---------------------------------------------------------
       
    68 //
       
    69 void CFavouritesItemImplList::InternalizeL( RReadStream& aStream )
       
    70     {
       
    71     TInt count = aStream.ReadInt32L();
       
    72     for ( TInt i = 0; i < count; i++ )
       
    73         {
       
    74         CFavouritesItemImpl* item = CFavouritesItemImpl::NewLC();
       
    75         item->InternalizeL( aStream );
       
    76         AppendL( item );
       
    77         CleanupStack::Pop( item );
       
    78         }
       
    79     }
       
    80 
       
    81 //  End of File