phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkContactFieldCollection.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Virtual Phonebook contact field collection.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "CVPbkContactFieldCollection.h"
       
    20 
       
    21 #include <MVPbkStoreContact.h>
       
    22 #include <MVPbkStoreContactField.h>
       
    23 
       
    24 EXPORT_C CVPbkContactFieldCollection* 
       
    25 CVPbkContactFieldCollection::NewLC(MVPbkStoreContact& aParentContact) 
       
    26     {
       
    27     CVPbkContactFieldCollection* self = new(ELeave)CVPbkContactFieldCollection(aParentContact);
       
    28     CleanupStack::PushL(self);
       
    29     return self;
       
    30     }
       
    31 
       
    32 CVPbkContactFieldCollection::CVPbkContactFieldCollection(MVPbkStoreContact& aParentContact) :
       
    33         iParentContact(aParentContact)
       
    34     {
       
    35     }
       
    36 
       
    37 CVPbkContactFieldCollection::~CVPbkContactFieldCollection()
       
    38     {
       
    39     iFields.ResetAndDestroy();
       
    40     }
       
    41 
       
    42 EXPORT_C void CVPbkContactFieldCollection::AppendL(MVPbkStoreContactField* aField)
       
    43     {
       
    44     iFields.AppendL(aField);
       
    45     }
       
    46 
       
    47 MVPbkBaseContact& CVPbkContactFieldCollection::ParentContact() const
       
    48     {
       
    49     return iParentContact;
       
    50     }
       
    51 
       
    52 MVPbkStoreContactField& CVPbkContactFieldCollection::FieldAt(TInt aIndex)
       
    53     {
       
    54     return *iFields[aIndex];
       
    55     }
       
    56 
       
    57 TInt CVPbkContactFieldCollection::FieldCount() const
       
    58     {
       
    59     return iFields.Count();
       
    60     }
       
    61 
       
    62 const MVPbkStoreContactField& CVPbkContactFieldCollection::FieldAt(TInt aIndex) const
       
    63     {
       
    64     return *iFields[aIndex];
       
    65     }
       
    66 
       
    67 MVPbkStoreContactField* CVPbkContactFieldCollection::FieldAtLC(TInt aIndex) const
       
    68     {
       
    69     MVPbkStoreContactField* field = iFields[aIndex];
       
    70     return field->CloneLC();
       
    71     }
       
    72 
       
    73 MVPbkStoreContact& CVPbkContactFieldCollection::ParentStoreContact() const
       
    74     {
       
    75     return iParentContact;
       
    76     }
       
    77     
       
    78 MVPbkStoreContactField* CVPbkContactFieldCollection::RetrieveField(
       
    79             const MVPbkContactLink& aContactLink) const
       
    80     {
       
    81     return iParentContact.Fields().RetrieveField(aContactLink);
       
    82     }
       
    83 
       
    84 // End of file