mtpfws/mtpfw/datatypes/src/tmtptypeuint64.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/tmtptypeuint64.h>
       
    23 
       
    24 /**
       
    25 Default constructor.
       
    26 */
       
    27 EXPORT_C TMTPTypeUint64::TMTPTypeUint64() :
       
    28     iData(0)
       
    29     {
       
    30     
       
    31     }
       
    32 
       
    33 /**
       
    34 Conversion constructor from native type.
       
    35 */
       
    36 EXPORT_C TMTPTypeUint64::TMTPTypeUint64(TUint64 aData) : 
       
    37     iData(aData)
       
    38     {
       
    39     
       
    40     }
       
    41     
       
    42 /**
       
    43 Sets the data type to the specified value.
       
    44 */  
       
    45 EXPORT_C void TMTPTypeUint64::Set(TUint64 aValue)
       
    46 	{
       
    47 	iData = aValue;
       
    48 	}
       
    49     
       
    50 /**
       
    51 Provides data types's value.
       
    52 @return The value of the data type
       
    53 */   
       
    54 EXPORT_C TUint64 TMTPTypeUint64::Value() const
       
    55 	{
       
    56 	return iData;
       
    57 	}
       
    58 	
       
    59 EXPORT_C TInt TMTPTypeUint64::FirstReadChunk(TPtrC8& aChunk) const
       
    60     {
       
    61 	aChunk.Set(reinterpret_cast<const TUint8*>(&iData), sizeof(iData));
       
    62     return KMTPChunkSequenceCompletion;
       
    63     }
       
    64 	
       
    65 EXPORT_C TInt TMTPTypeUint64::NextReadChunk(TPtrC8& aChunk) const
       
    66     {
       
    67     aChunk.Set(NULL, 0);
       
    68     return KErrNotReady;
       
    69     }
       
    70 	
       
    71 EXPORT_C TInt TMTPTypeUint64::FirstWriteChunk(TPtr8& aChunk)
       
    72     {
       
    73 	aChunk.Set(reinterpret_cast<TUint8*>(&iData), 0, sizeof(iData));
       
    74     return KMTPChunkSequenceCompletion;
       
    75     }
       
    76 	
       
    77 EXPORT_C TInt TMTPTypeUint64::NextWriteChunk(TPtr8& aChunk)
       
    78     {
       
    79     aChunk.Set(NULL, 0, 0);
       
    80     return KErrNotReady;
       
    81     }
       
    82 	
       
    83 EXPORT_C TUint64 TMTPTypeUint64::Size() const
       
    84 	{
       
    85 	return sizeof(iData);
       
    86 	}
       
    87 	
       
    88 EXPORT_C TUint TMTPTypeUint64::Type() const
       
    89 	{
       
    90 	return EMTPTypeUINT64;
       
    91 	}