mtpfws/mtpfw/datatypes/src/tmtptypeintbase.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/tmtptypeintbase.h>
       
    23     
       
    24 EXPORT_C TInt TMTPTypeIntBase::FirstReadChunk(TPtrC8& aChunk) const
       
    25     {
       
    26 	aChunk.Set(reinterpret_cast<const TUint8*>(&iData), iSize);
       
    27     return KMTPChunkSequenceCompletion;
       
    28     }
       
    29 	
       
    30 EXPORT_C TInt TMTPTypeIntBase::NextReadChunk(TPtrC8& aChunk) const
       
    31     {
       
    32     aChunk.Set(NULL, 0);
       
    33     return KErrNotReady;
       
    34     }
       
    35 	
       
    36 EXPORT_C TInt TMTPTypeIntBase::FirstWriteChunk(TPtr8& aChunk)
       
    37     {
       
    38 	aChunk.Set(reinterpret_cast<TUint8*>(&iData), 0, iSize);
       
    39     return KMTPChunkSequenceCompletion;
       
    40     }
       
    41 	
       
    42 EXPORT_C TInt TMTPTypeIntBase::NextWriteChunk(TPtr8& aChunk)
       
    43     {
       
    44     aChunk.Set(NULL, 0, 0);
       
    45     return KErrNotReady;
       
    46     }
       
    47 	
       
    48 EXPORT_C TUint64 TMTPTypeIntBase::Size() const
       
    49 	{
       
    50 	return iSize;
       
    51 	}
       
    52 	
       
    53 EXPORT_C TUint TMTPTypeIntBase::Type() const
       
    54 	{
       
    55 	return iType;
       
    56 	}
       
    57 
       
    58 /**
       
    59 Constructor.
       
    60 @param aData The INT data with which the type is to be initialised.
       
    61 @param aSize The size of the INT data type.
       
    62 @param aType The INT data type code.
       
    63 */
       
    64 EXPORT_C TMTPTypeIntBase::TMTPTypeIntBase(TInt aData, TUint aSize, TInt aType) : 
       
    65     iData(aData),
       
    66     iSize(aSize),
       
    67     iType(aType)
       
    68     {
       
    69     
       
    70     }
       
    71 
       
    72