mtpfws/mtpfw/datatypes/inc/cmtptypecomplexbuffer.h
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2008-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  @InternalTechnology
       
    19 */
       
    20 
       
    21 #ifndef _CMTPTYPECOMPLEXBUFFER_H
       
    22 #define _CMTPTYPECOMPLEXBUFFER_H
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <mtp/mmtptype.h>
       
    26     
       
    27 /**
       
    28 Defines the MTP Buffer data type. 
       
    29 @InternalTechnology
       
    30 @released 
       
    31 */
       
    32 class CMTPTypeComplexBuffer : public CBase, public MMTPType
       
    33     {
       
    34 public:
       
    35 
       
    36     IMPORT_C static CMTPTypeComplexBuffer* NewL();
       
    37     IMPORT_C static CMTPTypeComplexBuffer* NewL(const TDesC8& aData);
       
    38     IMPORT_C static CMTPTypeComplexBuffer* NewLC();
       
    39     IMPORT_C static CMTPTypeComplexBuffer* NewLC(const TDesC8& aData);
       
    40 	IMPORT_C ~CMTPTypeComplexBuffer();
       
    41     
       
    42 	
       
    43 	IMPORT_C const TDesC8& Buffer();
       
    44 	IMPORT_C void SetBuffer(const TDesC8& aData );
       
    45 	
       
    46 public: // From MMTPType
       
    47 
       
    48     IMPORT_C TInt FirstReadChunk(TPtrC8& aChunk) const;
       
    49     IMPORT_C TInt NextReadChunk(TPtrC8& aChunk) const;
       
    50     IMPORT_C TInt FirstWriteChunk(TPtr8& aChunk);
       
    51     IMPORT_C TInt NextWriteChunk(TPtr8& aChunk);
       
    52     IMPORT_C TUint64 Size() const;
       
    53     IMPORT_C TUint Type() const;
       
    54     IMPORT_C TBool CommitRequired() const;
       
    55     IMPORT_C MMTPType* CommitChunkL(TPtr8& aChunk);
       
    56     
       
    57 private:
       
    58 
       
    59     CMTPTypeComplexBuffer();
       
    60 	void ConstructL(const TDesC8& aData);	
       
    61 
       
    62 private:
       
    63 
       
    64     /**
       
    65     The read and write data stream states.
       
    66     */
       
    67     enum TReadWriteSequenceState
       
    68         {
       
    69         /**
       
    70         Data stream is inactive.
       
    71         */
       
    72         EIdle,
       
    73         
       
    74         /**
       
    75         Data stream is in progress.
       
    76         */
       
    77         EInProgress            
       
    78         };
       
    79 
       
    80     /**
       
    81     The intermediate data buffer. Note that this is declared mutable to allow 
       
    82     state updates while processing a read data stream.
       
    83     */
       
    84 	mutable RBuf8   iBuffer;
       
    85 
       
    86        
       
    87     /**
       
    88     The read data stream state variable. Note that this is declared mutable 
       
    89     to allow state updates while processing a read data stream.
       
    90     */
       
    91 	mutable TUint   iReadSequenceState;
       
    92     
       
    93     /**
       
    94     The write data stream state variable.
       
    95     */
       
    96 	TUint           iWriteSequenceState;
       
    97     };
       
    98     
       
    99 #endif // _CMTPTypeBuffer_H
       
   100