phonebookui/Phonebook2/Presentation/src/CPbk2StoreInfoItemArray.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  A class that reads an arrya of PBK2_STORE_INFO_ITEM resource
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "CPbk2StoreInfoItemArray.h"
       
    22 
       
    23 #include <RPbk2LocalizedResourceFile.h>
       
    24 #include <Pbk2DataCaging.hrh>
       
    25 #include "CPbk2StoreInfoItem.h"
       
    26 #include <MVPbkContactStoreInfo.h>
       
    27 #include <MVPbkContactStore.h>
       
    28 #include <MVPbkContactStoreList.h>
       
    29 #include <CVPbkContactManager.h>
       
    30 #include <TVPbkContactStoreUriPtr.h>
       
    31 #include <barsread.h>
       
    32 #include <coemain.h>
       
    33 
       
    34 
       
    35 // ============================ MEMBER FUNCTIONS ===============================
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CPbk2StoreInfoItemArray::CPbk2StoreInfoItemArray
       
    39 // C++ default constructor can NOT contain any code, that
       
    40 // might leave.
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 CPbk2StoreInfoItemArray::CPbk2StoreInfoItemArray()
       
    44     {
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CPbk2StoreInfoItemArray::ConstructL
       
    49 // Symbian 2nd phase constructor can leave.
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 void CPbk2StoreInfoItemArray::ConstructL(TResourceReader& aReader)
       
    53     {
       
    54     const TInt count = aReader.ReadInt16();
       
    55     for (TInt i = 0; i < count; ++i)
       
    56         {
       
    57         CPbk2StoreInfoItem* item = CPbk2StoreInfoItem::NewLC(aReader);
       
    58         iItems.AppendL(item);
       
    59         CleanupStack::Pop(item);
       
    60         }
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CPbk2StoreInfoItemArray::NewL
       
    65 // Two-phased constructor.
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 EXPORT_C CPbk2StoreInfoItemArray* CPbk2StoreInfoItemArray::NewL(
       
    69         TResourceReader& aReader)
       
    70     {
       
    71     CPbk2StoreInfoItemArray* self = new( ELeave ) CPbk2StoreInfoItemArray;
       
    72     CleanupStack::PushL(self);
       
    73     self->ConstructL(aReader);
       
    74     CleanupStack::Pop(self);
       
    75     return self;
       
    76     }
       
    77 
       
    78 // Destructor
       
    79 CPbk2StoreInfoItemArray::~CPbk2StoreInfoItemArray()
       
    80     {
       
    81     iItems.ResetAndDestroy();
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // CPbk2StoreInfoItemArray::Count
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 EXPORT_C TInt CPbk2StoreInfoItemArray::Count() const
       
    89     {
       
    90     return iItems.Count();
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CPbk2StoreInfoItemArray::At
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 EXPORT_C const CPbk2StoreInfoItem& CPbk2StoreInfoItemArray::At(
       
    98         TInt aIndex) const
       
    99     {
       
   100     return *iItems[aIndex];
       
   101     }
       
   102 
       
   103 //  End of File