phonebookengines/VirtualPhonebook/VPbkCntModel/inc/TContactFieldData.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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef VPBKCNTMODEL_TCONTACTFIELDDATA_H
       
    20 #define VPBKCNTMODEL_TCONTACTFIELDDATA_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <MVPbkContactFieldData.h>
       
    25 
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CContactItemField;
       
    29 /// Reserved name for a future extension to TContactFieldData
       
    30 class TContactFieldDataExt;
       
    31 
       
    32 
       
    33 // CLASS DECLARATIONS
       
    34 
       
    35 namespace VPbkCntModel {
       
    36 
       
    37 /**
       
    38  * Data layout class template for Contact Model field data -> 
       
    39  * MVPbkContactFieldData mapping.
       
    40  *
       
    41  * @param FieldData base class for this class. Must derive from 
       
    42  *                  MVPbkContactFieldData.
       
    43  */
       
    44 template< class FieldData >
       
    45 NONSHARABLE_CLASS( TContactFieldDataCommon ): public FieldData
       
    46     {
       
    47     protected:  // Constructor and destructor
       
    48         inline TContactFieldDataCommon();
       
    49         inline TContactFieldDataCommon
       
    50             (CContactItemField& aCntModelField);
       
    51 
       
    52     protected:  // Data
       
    53         CContactItemField* iCntModelField;
       
    54     };
       
    55 
       
    56 /**
       
    57  * Base class for Contact Model field data -> MVPbkContactFieldData mapping.
       
    58  */
       
    59 NONSHARABLE_CLASS( TContactFieldData ): 
       
    60         public TContactFieldDataCommon< MVPbkContactFieldData >
       
    61     {
       
    62     public:  // Constructor and destructor
       
    63         TContactFieldData();
       
    64         ~TContactFieldData();
       
    65 
       
    66     public:  // New functions
       
    67         /**
       
    68          * Sets the Contact Model field whose data to map.
       
    69          */
       
    70         void SetField(CContactItemField& aCntModelField);
       
    71 
       
    72         /**
       
    73          * Removes field mapping.
       
    74          */
       
    75         void ResetField();
       
    76 
       
    77     private:  // from MVPbkContactFieldData
       
    78         /// Private to make static call attempts fail
       
    79         TVPbkFieldStorageType DataType() const;
       
    80         /// Private to make static call attempts fail
       
    81         TBool IsEmpty() const;
       
    82         /// Private to make static call attempts fail
       
    83         void CopyL(const MVPbkContactFieldData& aFieldData);
       
    84 
       
    85     private: // Hidden functions
       
    86         /// Hidden copy constructor
       
    87         TContactFieldData(const TContactFieldData&);
       
    88         /// Hidden assignment operator
       
    89         TContactFieldData& operator=(const TContactFieldData&);
       
    90     };
       
    91 
       
    92 
       
    93 // INLINE FUNCTIONS
       
    94 
       
    95 template< class FieldData >
       
    96 inline TContactFieldDataCommon<FieldData>::TContactFieldDataCommon() :
       
    97     iCntModelField(NULL)
       
    98     {
       
    99     }
       
   100 
       
   101 template< class FieldData >
       
   102 inline TContactFieldDataCommon<FieldData>::TContactFieldDataCommon
       
   103         (CContactItemField& aCntModelField) :
       
   104     iCntModelField(&aCntModelField)
       
   105     {
       
   106     }
       
   107 
       
   108 }  // namespace VPbkCntModel
       
   109 
       
   110 #endif  // VPBKCNTMODEL_TCONTACTFIELDDATA_H
       
   111 //End of file
       
   112 
       
   113