phonebookengines/VirtualPhonebook/VPbkCntModel/src/TContactFieldData.cpp
branchRCL_3
changeset 20 f4a778e096c2
parent 0 e686773b3f54
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     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 // INCLUDES
       
    20 #include <cntdef.h>
       
    21 #include <cntfield.h>
       
    22 #include "TContactFieldData.h"
       
    23 #include "TContactFieldDataImpl.h"
       
    24 #include "VPbkCntModelUid.h"
       
    25 
       
    26 namespace VPbkCntModel {
       
    27 
       
    28 TContactFieldData::TContactFieldData()
       
    29     {
       
    30     // Constructor implemented to force class vftable generation to this module
       
    31     }
       
    32 
       
    33 TContactFieldData::~TContactFieldData()
       
    34     {
       
    35     // Destructor implemented to force class vftable generation to this module
       
    36     }
       
    37 
       
    38 void TContactFieldData::SetField(CContactItemField& aCntModelField)
       
    39     {
       
    40     // Instantiate a layout-compatible mapping class to this object's location
       
    41     // using placement new.
       
    42     switch( aCntModelField.StorageType() )
       
    43         {
       
    44         case KStorageTypeText:
       
    45             {
       
    46             TFieldType fType = {KUidContactFieldIMPPValue};
       
    47             if (aCntModelField.ContentType().ContainsFieldType(fType))
       
    48                 {
       
    49                 ::new(this) TContactFieldUriData(aCntModelField);
       
    50                 }
       
    51             else
       
    52                 {
       
    53                 ::new(this) TContactFieldTextData(aCntModelField);
       
    54                 }
       
    55             break;
       
    56             }
       
    57         case KStorageTypeStore:
       
    58             {
       
    59             ::new(this) TContactFieldBinaryData(aCntModelField);
       
    60             break;
       
    61             }
       
    62         case KStorageTypeDateTime:
       
    63             {
       
    64             ::new(this) TContactFieldDateTimeData(aCntModelField);
       
    65             break;
       
    66             }
       
    67         default:
       
    68             {
       
    69             ResetField();
       
    70             }
       
    71         }
       
    72     }
       
    73 
       
    74 void TContactFieldData::ResetField()
       
    75     {
       
    76     // Reset vfptr
       
    77     ::new(this) TContactFieldData;
       
    78     }
       
    79 
       
    80 TVPbkFieldStorageType TContactFieldData::DataType() const
       
    81     {
       
    82     return EVPbkFieldStorageTypeNull;
       
    83     }
       
    84 
       
    85 TBool TContactFieldData::IsEmpty() const
       
    86     {
       
    87     return ETrue;
       
    88     }
       
    89 
       
    90 void TContactFieldData::CopyL(const MVPbkContactFieldData& /*aFieldData*/)
       
    91     {
       
    92     }
       
    93 
       
    94 }  // namespace VPbkCntModel
       
    95