mtpfws/mtpfw/datatypes/src/tmtptypenull.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/tmtptypenull.h>
       
    23 
       
    24 #include "mtpdatatypespanic.h"
       
    25 
       
    26 /**
       
    27 Default constructor.
       
    28 */
       
    29 EXPORT_C TMTPTypeNull::TMTPTypeNull() :
       
    30 	iNullBuffer(NULL, 0, 0)
       
    31     {
       
    32     }
       
    33 
       
    34 /**
       
    35 Sets the data sink buffer to be used in write data stream operations.
       
    36 @param aBuffer The data sink buffer.
       
    37 */
       
    38     
       
    39 EXPORT_C void TMTPTypeNull::SetBuffer(const TDes8& aBuffer)
       
    40 	{
       
    41 	iNullBuffer.Set(aBuffer.MidTPtr(0));
       
    42 	}
       
    43     
       
    44 EXPORT_C TInt TMTPTypeNull::FirstReadChunk(TPtrC8& aChunk) const
       
    45     {
       
    46     aChunk.Set(KNullDesC8);
       
    47     return KMTPChunkSequenceCompletion;
       
    48     }
       
    49     
       
    50 EXPORT_C TInt TMTPTypeNull::NextReadChunk(TPtrC8& aChunk) const
       
    51     {
       
    52     aChunk.Set(KNullDesC8);
       
    53     return KErrNotReady;
       
    54     }
       
    55     
       
    56 EXPORT_C TInt TMTPTypeNull::FirstWriteChunk(TPtr8& aChunk)
       
    57     {
       
    58     aChunk.Set(&iNullBuffer[0], 0, iNullBuffer.MaxLength());
       
    59     return KErrNone;
       
    60     }
       
    61     
       
    62 EXPORT_C TInt TMTPTypeNull::NextWriteChunk(TPtr8& aChunk)
       
    63 	{
       
    64     aChunk.Set(&iNullBuffer[0], 0, iNullBuffer.MaxLength());
       
    65     return KErrNone;
       
    66     }
       
    67     
       
    68 EXPORT_C TUint64 TMTPTypeNull::Size() const
       
    69     {
       
    70     return 0;
       
    71     }
       
    72 
       
    73 EXPORT_C TUint TMTPTypeNull::Type() const
       
    74     {
       
    75     return EMTPTypeUndefined;        
       
    76     }