mtpfws/mtpfw/datatypes/src/tmtptypedatapair.cpp
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17 @file
       
    18 @publishedPartner
       
    19 */ 
       
    20 
       
    21 #include <mtp/mtpdatatypeconstants.h>
       
    22 #include <mtp/tmtptypedatapair.h>
       
    23 
       
    24 // data pair element metadata.
       
    25 const TMTPTypeDataPair::TElementInfo TMTPTypeDataPair::iElementMetaData[ENumElements] = 
       
    26     {
       
    27         {EMTPTypeUINT32,    0,  KMTPTypeUINT32Size},    // EOwnerHandle
       
    28         {EMTPTypeUINT16,    4,  KMTPTypeUINT16Size},    // EDataCode
       
    29     };
       
    30 
       
    31 /**
       
    32 Constructor.
       
    33 */
       
    34 EXPORT_C TMTPTypeDataPair::TMTPTypeDataPair() :
       
    35     iElementInfo(iElementMetaData, ENumElements),
       
    36     iBuffer(KSize)
       
    37     {
       
    38     SetBuffer(iBuffer);
       
    39     }
       
    40     
       
    41 EXPORT_C TMTPTypeDataPair::TMTPTypeDataPair( const TUint32 aHandle, const TUint16 aCode ):
       
    42 	iElementInfo(iElementMetaData, ENumElements),
       
    43 	iBuffer(KSize)
       
    44 	{
       
    45     SetBuffer(iBuffer);
       
    46 	SetUint32( TMTPTypeDataPair::EOwnerHandle, aHandle );
       
    47 	SetUint16(TMTPTypeDataPair::EDataCode, aCode);
       
    48 	}
       
    49 
       
    50 EXPORT_C TMTPTypeDataPair::TMTPTypeDataPair(const TMTPTypeDataPair& aPair):
       
    51     iElementInfo(iElementMetaData, ENumElements),
       
    52     iBuffer(KSize)
       
    53     {
       
    54     iBuffer = aPair.iBuffer;
       
    55     SetBuffer(iBuffer);
       
    56     }
       
    57 
       
    58 EXPORT_C TUint TMTPTypeDataPair::Type() const
       
    59     {
       
    60     return EMTPTypeDataPair;
       
    61     }
       
    62     
       
    63 const TMTPTypeFlatBase::TElementInfo& TMTPTypeDataPair::ElementInfo(TInt aElementId) const
       
    64     {
       
    65     return iElementInfo[aElementId];
       
    66     }