phonebookengines/VirtualPhonebook/VPbkCntModel/inc/TContactFieldCollection.h
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2004-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:  Maps a Contact Model field collection to a virtual Phonebook 
       
    15                  field collection.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef VPBKCNTMODEL_TCONTACTFIELDCOLLECTION_H
       
    21 #define VPBKCNTMODEL_TCONTACTFIELDCOLLECTION_H
       
    22 
       
    23 
       
    24 // INCLUDES
       
    25 #include <MVPbkStoreContactFieldCollection.h>
       
    26 #include "TContactField.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CContactItemFieldSet;
       
    30 
       
    31 namespace VPbkCntModel {
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 class CContact;
       
    35 
       
    36 // CLASS DECLARATIONS
       
    37 
       
    38 /**
       
    39  * Maps a Contact Model field collection to a virtual Phonebook field collection.
       
    40  */
       
    41 NONSHARABLE_CLASS( TContactFieldCollection ): 
       
    42         public MVPbkStoreContactFieldCollection
       
    43     {
       
    44     public:  // Constructor and destructor
       
    45         /**
       
    46          * Constructor.
       
    47          *
       
    48          * @param aParentContact    the contact whose field collection this is.
       
    49          * @parma aFieldSet         the Contact Model field set to map.
       
    50          */
       
    51         TContactFieldCollection
       
    52             (CContact& aParentContact, CContactItemFieldSet& aFieldSet);
       
    53 
       
    54         /**
       
    55          * Destructor.
       
    56          */
       
    57         ~TContactFieldCollection();
       
    58 
       
    59     public:  // New functions
       
    60         /**
       
    61          * Resets a new parent contact for this field collection.
       
    62          *
       
    63          * @param aParentContact    the contact whose field collection this is.
       
    64          * @parma aFieldSet         the Contact Model field set to map.
       
    65          */
       
    66         void SetContact
       
    67             (CContact& aParentContact, CContactItemFieldSet& aFieldSet);
       
    68 
       
    69         /**
       
    70          * Returns a pointer to the field that is used as a return value of 
       
    71          * FieldAt functions.
       
    72          *
       
    73          * @see CContact::AddFieldL
       
    74          */
       
    75         const MVPbkStoreContactField* FieldPointer() const;
       
    76 
       
    77     public:  // from MVPbkStoreContactFieldCollection
       
    78         MVPbkBaseContact& ParentContact() const;
       
    79         TInt FieldCount() const;
       
    80         const MVPbkStoreContactField& FieldAt(TInt aIndex) const;
       
    81         MVPbkStoreContactField& FieldAt(TInt aIndex);
       
    82         MVPbkStoreContactField* FieldAtLC(TInt aIndex) const;
       
    83         MVPbkStoreContact& ParentStoreContact() const;
       
    84         MVPbkStoreContactField* RetrieveField(
       
    85             const MVPbkContactLink& aContactLink) const;
       
    86 
       
    87     private:  // Data
       
    88         CContactItemFieldSet* iFieldSet;
       
    89         mutable TContactField iCurrentField;
       
    90         CContact* iParentContact;
       
    91     };
       
    92 
       
    93 
       
    94 // INLINE FUNCTIONS
       
    95 
       
    96 inline const MVPbkStoreContactField* TContactFieldCollection::FieldPointer() const
       
    97     {
       
    98     return &iCurrentField;
       
    99     }
       
   100 
       
   101 
       
   102 } // namespace VPbkCntModel
       
   103 
       
   104 #endif  // VPBKCNTMODEL_TCONTACTFIELDCOLLECTION_H
       
   105 //End of file
       
   106 
       
   107